Compare commits

..
Author SHA1 Message Date
jschoubben bf642c45b7 mesh-delivery: the old hand-kept mesh-catalog contract copy loses the config-candidates layout (issue 1982; ADR 0681 §2)
The copy under contracts/go/seats/meshcatalog still held the layout, its key helpers, its constant and two fixture cases; nothing
in contracts/ or sdk/ uses them, and ADR 0681 §7's check greps the trunk for the name.

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

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

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 22:47:44 +01:00
mesh-tools 0ea4b60dbd Merge pull request 'steprun: only runs that started count toward poison; every end of an ask is written, said and acknowledged (A-489, A-489a, A-489b, A-489c)' (#257) from fix/build-node-step-ends into main 2026-11-19 21:40:15 +00:00
mesh-tools 5da42d1775 Merge pull request 'Catalog versions: each module's version floor from its Go tags and its package holders, per module, as a kept call (A-490c..A-490i, §412)' (#260) from fix/catalog-versions-first-fill into main 2026-11-19 21:40:12 +00:00
mesh-tools 0639ec4bca Merge pull request 'Builder: build again a done trunk key whose version is unreleased, reserved afresh; a trunk build without its version fails (A-490, A-490b; carries the reservation takeover A-455..A-473)' (#259) from fix/builder-unreleased-build-again into main 2026-11-19 21:40:10 +00:00
mesh-tools ac833a48f8 Merge pull request 'publishconformance: the cases every package holder is held to for a publish with a digest and no parts (A-490, A-490a)' (#258) from fix/gitea-publish-by-digest into main 2026-11-19 21:40:02 +00:00
jschoubben d9596548f9 publishconformance: a version held under another digest is refused though reserved with no digest yet (A-490j, A-490a)
Builds: design 47 G A-490j, A-490a

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 21:39:21 +01:00
jschoubben 9a7cd5861d Builder: a published kept at a version whose recorded digests none matches raises the finding at once, the version taken and never released (A-490j)
Builds: design 47 G A-490j

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 21:34:58 +01:00
jschoubben 95b4b308ad publishconformance: the cases of a one-part publish made while the build runs, reserved with no digest yet among them (A-490j)
Builds: design 47 G A-490j, A-490a

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 21:33:46 +01:00
jschoubben b413949ea8 Catalog versions: the floor's finding clears on every exit of the fill, and the integration test shows the kept call asked again
FillFloor clears the module's call-unanswered finding and its call-since key on every exit but the end of its context (a release
gave the module a version, it left the trunk, the callee answered with a failure), as ADR 0668 §3 has: FloorModules never
picks the module again. The module's clock starts at its first unanswered try, not when the form gives up. The integration test
sets the form's bound to one second, waits for the module's call-since key in the state heard, and only then serves git.tags;
it fails with `return err` at the unanswered try. Unit cases for the three exits.

Builds: design 47 G §412, A-490g, A-490h, A-490i
Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 17:42:56 +01:00
jschoubben 69d17f139f Catalog versions: a floor read is a kept call asked until it answers, one module at a time, and the indexer holds no timer
A-490i corrects A-490h: the growing-pause timer is gone (floorpause.go and the guard's exemption removed; ADR 0437 §8 stands).
Each module's floor is read on its own (FloorModules, FillFloor); a read is a kept call through mesh-sdk's form, asked again
at once when the form gives up, so it has no bound; the first unanswered try starts the module's clock and the finding
call-unanswered is written five minutes later and cleared on answer. The integration test leaves the forge unserved until
a delay, and the fill follows with no restart and no revision.

Builds: design 47 G §412, A-490c, A-490d, A-490e, A-490f, A-490g, A-490h, A-490i
Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 17:36:05 +01:00
jschoubben 1175fef241 Catalog versions: the floor reads every package's holders too, asks again on a growing pause, and a floor entry takes its release
The floor of a module with no version is the highest among its Go tags and the versions each package holder answers through
its seat's verb versions (npm-package-registry, go-package-registry; the sdk's npm 0.1.18 above its Go tags 0.1.16). An
unanswered read is asked again on a growing pause (5 s, 15 s, 30 s, 1, 2, 5 min) until it answers, with call-unanswered five
minutes after the first. A floor entry holds no artifacts, so a package-published heard later at its version is recorded as
its release and says version-released. One whole-indexer integration test on a real bus with a stand-in seat git and holder.

Builds: design 47 G §412, A-490c, A-490d, A-490e, A-490f, A-490g, A-490h
Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 17:33:06 +01:00
jschoubben d822259cfa Builder: the rebuild path passes Rebuild to the reserver, and a build-level test through the real reserver proves it (A-490b)
Builds: design 47 G A-490b, §369

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 17:11:52 +01:00
jschoubben ea4fe471e2 Catalog versions: fill the tag floor per module with no version, from the forge's Go tags
mesh-catalog.versions answered [] for mesh-sdk although the forge holds go/v0.1.12..v0.1.16: the first fill read only
builder_versions, so a module the builder held nothing of was filled with nothing, and the once-only key closed it. The
indexer now reads, for every module of the newest trunk revision the versions hold none of, every tag of its Go package
from the seat git's verb tags (repository of its catalog entry, prefix the package's directory + "/v", "v" at the root),
fills the highest as its version, at each start and each catalog revision kept, and raises call-unanswered after five
minutes when the forge does not answer.

Builds: design 47 G §412, A-490b, A-490c, A-490d, A-490e
Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 17:11:15 +01:00
jschoubben ff7a27f36f Builder: a build again reserves above the catalog's highest alone, its own standing number no floor (A-490b)
Reserver.Reserve takes Source.Rebuild: this fingerprint's standing reservation is replaced (Took told) and is no floor; another
fingerprint's stays one. Tested against the real reserver, standing below and above the catalog's highest.

Builds: design 47 G A-490b, §369

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 17:10:15 +01:00
jschoubben 7de5814a26 publishconformance: the other digest does not contain the digest; the holds-nothing case checks the words not stored (A-490, A-490a)
Builds: design 47 G A-490, A-490a

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 17:09:16 +01:00
jschoubben dfdfd84efe publishconformance: the holder that holds the version under another digest refuses it as not stored (A-490, A-490a)
Builds: design 47 G A-490, A-490a (stays in mesh-delivery-sdk beside the build modules' conformance kit, §680)

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 17:04:55 +01:00
jschoubben 68048619d9 Builder: a done key built again by hand reserves afresh above the released versions, never keeping the standing number (A-490b)
Builds: design 47 G A-490b, A-490, A-455, §369, §412

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 17:04:27 +01:00
jschoubben 8f17d59f5c Builder: a trunk build that reserves is never made without its version, and a done key whose version is not released is built again by hand (A-490)
Quick fix: loosen the refusal of builder_build_again for the one key. Thorough fix (built): a reservation that cannot be made fails the key
instead of building and ending done unreserved (the kind met three times on 2026-11-19), and builder_build_again takes a done key whose
version is not released, claims it as a new revision, keeps or makes its reservation and builds it whole so the build's own publish runs.

Builds: design 47 G A-490, A-417, A-473, §369

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 17:01:00 +01:00
jschoubben 50734000c3 Merge origin/main into the builder reservation takeover work 2026-11-19 16:59:19 +01:00
jschoubben 2bc9ea9377 publishconformance: the cases every publish holder is held to for a publish with a digest and no parts
Builds: design 47 G A-73, A-417, A-490

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 16:51:10 +01:00
jschoubben 7617dda5f6 steprun: an ask naming no recipe is not declined for its recipe
The runner names a step ask's toolchain by language and version; every node sat out every TypeScript step.

Builds: design 47 G §416 (A-104)

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 16:27:26 +01:00
jschoubben 13db05ce60 steprun: the decline of a pipeline step is held by a test; RunsCounted cites A-489c
Builds: design 47 G §24; lead answers A-489a, A-489c

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 15:45:48 +01:00
jschoubben 334bc54767 steprun: an unread ask whose refusal cannot be written is given back; the unwritten-end and said-end cases assert what they claim; kit case RunsCounted
Builds: design 47 G §24; lead answers A-489a, A-489b

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 15:42:16 +01:00
mesh-tools 6f8ba0bf69 Merge pull request 'The seat-holder answer is read from the assigner's watched copy, so asking who holds a seat no longer takes 14 s (issue 1982)' (#256) from fix/1982-seat-holders-from-watched-copy into main 2026-11-19 14:41:47 +00:00
jschoubben 92196dde3a steprun: an ask on its last delivery is ended, every end is acknowledged, an unwritten end is given back (A-489a)
Builds: design 47 G §24, §25; lead answers A-489, A-489a

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 15:38:16 +01:00
jschoubben 16feb56fd4 steprun: PriorRuns reads a module's ReadSteps shape
Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 15:24:37 +01:00
jschoubben 78adc23d70 steprun: only runs that started count toward poison; an ended ask is acknowledged and its poison end said (A-489)
The bus counts an ask given back before it ran as a delivery, so four asks were ended 'poison' having never run. Puller.Prior
(PriorRuns) counts the runs the step key says started. A poisoned pipeline step now says its step-ended, so the runner stops
waiting. refuseUnread, refuseAsker and the poison path acknowledge the ask once its end is written, not terminate it.

Builds: design 47 G §24, §25; lead answer A-489 (G-22-lead-answers-2.md)

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 15:23:13 +01:00
jschoubben 79bca88c8a steprun: a build module whose steps cannot say a step's end fails its own test (conformance.StepEnds)
A step ask refused live with 'this build module says no step's end' (mesh-build-node set no SayStep). AskSteps.SaysItsEnds
and the kit case conformance.StepEnds refuse that where the module is built.

Builds: design 47 G §24 (Asked on a work queue, ended by an event)

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 15:23:13 +01:00
jochen 5bca54bb59 assigner: the verb assignments with seats answers from the watched copy of seat-holders, falling back to a direct listing only while it cannot be read (issue 1982) 2026-11-19 14:32:37 +01:00
mesh-tools 1751bff172 Merge pull request 'A pipeline step's ask names its build seat's language; the toolchain stays keyed by the artifact's (A-488, A-488b)' (#255) from fix/ask-language-from-seat into main 2026-11-19 12:51:10 +00:00
jschoubben 2e03fcb875 A step ask's toolchain is read by the artifact's toolchain language, not the ask's
The ask's language names the seat (A-488), so the runner read the toolchain of node for a TypeScript step and none matched. Asked carries
the artifact's language, and the placement test holds a go and a TypeScript artifact to their seats and their toolchains.

Builds: design 47 G A-488, A-488b (hq 57c14047)
Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 13:48:29 +01:00
jschoubben b3e52ecdef A pipeline step's ask names the language of the build seat it is asked of
stepAsk took the artifact's language word (typescript), which node-build-node's module refuses as unreadable (go, node, image). The
language is now derived from the chosen seat (buildstep.AskLanguageOfSeat), and the placement test holds every ask to its seat.

Builds: design 47 G A-488 (hq 25df48ad)
Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 13:41:48 +01:00
mesh-tools 1eec825926 Merge pull request 'Every reader of the newest catalog revision reads the newest again when it is removed under it (A-487d)' (#254) from fix/newest-readers-again into main 2026-11-19 11:54:40 +00:00
jschoubben 04500fa29d Outdated says a trunk read that fails twice instead of leaving out its kinds 3 and 5
Builds: design 47 G A-487d (hq 61bf1215)
Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 12:53:33 +01:00
jschoubben 900316e4bd The tool indexer_catalog_revision and the verb revision of a watched branch read the newest again
The default read of the tool and the newest revision of a branch other than the trunk use readNewestOf; a read by number keeps
failing loudly. One table covers every reader of the newest revision in the indexer program.

Builds: design 47 G A-487d (hq 61bf1215)
Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 12:51:40 +01:00
mesh-tools 233824eeeb Merge pull request 'takein: the test's pending revision names a lost merge (TestTakeInEvents fails on main since A-476 b)' (#253) from fix/takein-test-sample into main 2026-11-19 11:51:17 +00:00
jschoubben 6d6caf20e1 takein: the test's pending revision names a lost merge, since A-476 (b) no longer counts a build it waits for
TestTakeInEvents failed on main since A-476 (b) dropped WaitsFor as a reason a pending revision holds; its sample and one
refusal case still named only that. Seen in main.1025.mesh-delivery-indexer, unit and integration.

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 12:50:53 +01:00
jschoubben 00b452e57b The readers of the newest trunk revision read the newest again when it is removed under them
ModuleInNewestView, SeedEntryHeld, entryOf, SeedModulesFrom, the first fill of the versions, the outdated tool's trunk read and the verb
revision without a kept view use readNewestOf; none of them holds keepMu.

Builds: design 47 G A-487d (hq 61bf1215)
Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 12:48:14 +01:00
mesh-tools e952ab721b Merge pull request 'A read of the newest catalog revision reads the newest again when its revision is removed under it (A-487d)' (#252) from fix/catalog-revision-read-race into main 2026-11-19 11:47:37 +00:00
jschoubben 33143527f2 A read of the newest revision names the newest again while it is newer than the one that failed
Replaces the five tries: progress bounds the loop, the same revision failing twice is the read's failure. One helper,
readNewestOf, serves the kept trunk's reads, TrunkView and BranchView; a read by number still fails loudly.

Builds: design 47 G A-487d (hq 61bf1215), A-487, A-487b
Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 12:17:40 +01:00
jschoubben 1dd16bc783 The kept trunk reads the newest revision again when the one named is removed under the read
The pin judge removes a trunk revision, its list and its entries, as soon as a newer one is kept; take-ins keep one every few
seconds, so the read of the newest revision failed with no such object and the first view of the catalog half never came.

Builds: design 47 G A-487, A-487b
Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 12:10:51 +01:00
mesh-tools 7ba0eddd92 Merge pull request 'Catalog answers from its newest trunk revision in memory (A-479, A-487, A-487b, A-487c)' (#251) from fix/catalog-answers-from-memory into main 2026-11-19 10:48:58 +00:00
jschoubben 37dd3dac13 Merge fix/a479-catalog-answers-in-time (ea106ea8) into the catalog-answers-from-memory branch
Builds: design 47 G A-487..A-487c, A-479

# Conflicts:
#	modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer-tools/catalog.go
#	modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer-tools/main.go
2026-11-19 01:24:39 +01:00
jschoubben 533a9e4ca9 Revision, module and provides answer from the held trunk revision; a failed re-read is said as behind
KeptTrunk also holds the newest revision and its entries, and the manifests the entries carry by digest.
The verb revision asked of the trunk's newest and the manifests the verbs module and provides read come
from it, with no read of the bucket or the manifests state; a candidate, a branch and an older number
still read the bucket. A failed re-read says the view is BEHIND and the next heard catalog-revision
reads again. The follower's state is named catalog-half.

Builds: design 47 G §421, lead answers A-487, A-487b, A-487c (03-DESIGN/01-to-be/47-milestones/G-22-lead-answers-2.md)
2026-11-19 01:19:32 +01:00
jschoubben efd8c7b34f Catalog half reads its own objects at the start and on the heard catalog-revision; no invoke of its own seat
KeptTrunk reads the newest trunk revision from catalog-revisions once at the start (a follower of the
bundle's views.Reader, adopted on the seat's event catalog-revision) and re-reads once for each heard
event of a newer trunk revision; reads list nothing. The invoke seat:mesh-catalog.revision and the
meshcatalogclient follower are removed; the consume stays.

Builds: design 47 G §421, lead answers A-487 and A-487b (03-DESIGN/01-to-be/47-milestones/G-22-lead-answers-2.md)
2026-11-19 01:04:33 +01:00
jschoubben 80cfaa175f Catalog answers from the newest trunk revision held in memory, and module reads one module
The tools bundle's view of the trunk (KeptTrunk) is made from the half of the catalog its own follower
of the seat holds (meshcatalogclient.WireCatalog on a views.Reader: the newest revision once at the
start, again on the seat's event catalog-revision), once per revision, and says each read with its
revision, module count and time. A read no longer lists catalog-revisions or fetches the newest
revision object. The verb module reads the one module it is asked (CatalogRead.Module). The manifest
consumes mesh-catalog.catalog-revision and invokes seat:mesh-catalog.revision for the follower.

Builds: design 47 G §421, lead answer A-487 (03-DESIGN/01-to-be/47-milestones/G-22-lead-answers-2.md)
2026-11-19 01:02:43 +01:00
mesh-tools 16b795af70 Merge pull request 'Pipeline runner: a tool for every seat verb no tool reaches (A-486)' (#250) from fix/runner-verb-tools into main 2026-11-18 21:37:19 +00:00
jschoubben 59ca36e55b G1: tools runner_start, runner_run, runner_accept, runner_ask_again over the runner's seat verbs
Each tool asks its served verb with the same arguments and answers its answer; the verb records the hand act, as for runner_rerun. Declared in the manifest.
The seat has no verb release: no tool for it.
Lead answer A-486 (G-22-lead-answers-2.md): tools are how a module is spoken to.

Builds: design 47 G §83, §84, A-486
2026-11-18 02:22:54 +01:00
mesh-tools 09be0bc27f Merge pull request 'Judge: a process's own secrets belong to the account it runs as (ADR 0680)' (#249) from fix/adr0680-credential-owner into main 2026-11-18 01:18:50 +00:00
jschoubben 3a47cccbee Judge: a process's own secrets belong to the account it runs as, whatever that account (ADR 0680)
The refusals of root and the operator account as an own secret's owner and as a bus process's account end; the
secrets-owner is held to the accounts an own secret's owner is; a process naming an own secret (a word equal to its
path) it runs neither as the owner of nor as root is refused, container modules excepted (lead answer A-485).
Restic's captured manifest is re-captured from mesh-catalog cd3b8fe8 by CAPTURED's recipe.

Builds: ADR 0680 §2, §3, §4; lead answer A-485
2026-11-18 02:11:47 +01:00
jschoubben ea106ea8b9 A-479: the seat mesh-catalog's verbs answer from memory, one read of the trunk view per call
The tools bundle's verbs module, modules, provides and dependents read the modules and the module graph key by key from
the newest trunk revision, and each key listed the whole catalog-revisions bucket again (6 s per call at 11 000 objects,
35 s with 12 callers); seat-definitions read its state once per seat. The view is read once per call (SourceValues), the
seat definitions come from a watched copy, a manifest is read once by its digest.

Builds: design 47 G (the seat mesh-catalog's verbs served by the indexer's tools bundle; ADR 0604 §2, ADR 0580 clause 1)
2026-11-17 22:43:08 +01:00
jschoubben ae91c7e73a Builder: remove Republisher.Ended, which nothing calls since the publish item asks at a build's end (A-457a, A-473)
Builds: design 47 G A-457a, A-473
2026-11-17 21:26:46 +01:00
jschoubben 378853a97d Builder: a late look that numbers a done build with no reservation says so aloud and names builder_reserve_done (A-455, G §349)
Builds: design 47 G A-455, A-473, §349
2026-11-17 21:23:37 +01:00
jschoubben 33e5c3a105 Builder: tests that fail without the round-2 changes (publish item kept with its artifacts published, asked at the build's end and at the start, unreadable plan)
Builds: design 47 G A-456b, A-457a
2026-11-17 21:22:31 +01:00
jschoubben 91f3ef809c Builder: remove the setting republish-max-versions, which nothing reads since A-457a
Builds: design 47 G A-457a
2026-11-17 21:22:31 +01:00
jschoubben 9e793e0142 Builder: review round 2 of the publish items and the release record (A-456b)
QueueDone removed; an item is deleted only with its release, drop or takeover; releases kept
one key per module (released-kept, 16); a plan that cannot be read ends the step could not run;
the wiring of the items to the reservations and the re-ask watch is tested.

Builds: design 47 G A-456b, A-457a, A-456a
2026-11-17 21:22:31 +01:00
jschoubben 65c4dcbf73 Builder: a version's publish is a publish item of the re-ask state, tried with a growing pause until its release (A-457a)
Asked when the build ends and at the start, deleted by the release, ended loudly after publish-tries
tries and readable in builder_publish_queue; settings publish-pause, publish-pause-max, publish-tries.
The publish no longer waits on running or manifest-reads-changed.

Builds: design 47 G A-457, A-457a, §588
2026-11-17 21:22:31 +01:00
jschoubben 43ec4017be Builder: a released build counts as reserved for the build step (A-456a)
Builds: design 47 G A-456a, A-456
2026-11-17 21:22:09 +01:00
jschoubben ab8a8ddfc4 Builder: a build step passes a reserving build only with a version reserved for its fingerprint (A-456)
Builds: design 47 G A-456, §369, §588, A-455
2026-11-17 21:22:09 +01:00
jschoubben 22f252251c Builder: test the reserve-done act, its reasks dispatch and its tool (A-455 review round 1)
Builds: design 47 G A-455, §369, §588
2026-11-17 21:22:09 +01:00
jschoubben bec4d43da6 Builder: a build takes over an older unreleased reservation; builder_reserve_done reserves for a done build
A trunk build reserving while its series is reserved by an older build never
released drops the older reservation's bound and finding and says so in the
journal. builder_reserve_done (a hand act, reasks mode reserve-done) reserves
the series' next version for a done trunk build that reserved none, with the
done key's digests, and queues its publish as builder_publish_again does.

Builds: design 47 G A-455, §369, §588
2026-11-17 21:22:09 +01:00
jschoubben d006132c2a A-476 (b): the watchman and the view no longer name an indexer build a revision waits for
A pending revision now holds a lost or unread message or a refusal; the watchman's finding and the view's wait say so, the take-in
event no longer requires WaitsFor (old values still decode), and the hand take-in comment loses the build.

Builds: design 47 G A-476 (b)
2026-11-17 20:37:32 +01:00
jschoubben 763d6a107a A-476, principle 4: indexer_take_in_pending takes a pending revision in again, and a group
A revision whose message is unread or lost, or held for room, has a hand recovery; its description says nothing of an indexer build.

Builds: design 47 G A-476
2026-11-17 20:34:49 +01:00
jschoubben a79b811113 A-476 r1: no merge waits for the build the indexer runs; leftovers of the validation and the hold go; a commit's scope is decided inside the recompute
ErrOwnBuildUnknown, its say and the own-build-unknown wait, TakeIn.Unknown and Failed go; the build only names the writer.
indexer_take_in_pending takes only a group in. The node-build-go accept.check and output invokes go. A module of another
repository stays as held inside of(), so a base of this repository's module is not given a value that is never written
(A-476 c, A-476a); one case in the toolchains test proves it.

Builds: design 47 G A-476, A-476a
2026-11-17 20:33:52 +01:00
jschoubben 40b6ced375 A-476a: a commit moves its own repository's modules and the importers of what it moved; A-471 toolchain test data
The recompute of a merge leaves a module of another repository as held unless its imported package versions changed
(ADR 0593 §3 stands). TestIndexerCountsOnlyThePlacedBuildNodesToolchains reports language versions (A-471).

Builds: design 47 G A-476a, A-471
2026-11-17 20:22:55 +01:00
jschoubben 9768d0b67d A-476: the take-in asks no validation, holds for no indexer build, and moves only its repository's modules
(a) validation_wait.go and validate.go go with the validation ask, its end consumer, indexer_validate_again and
Pending.Validation; (b) evaluate always takes the revision in with the build the program runs (holdFor and the build
comparison go); (c) a merge's recompute writes only the modules registered for its repository.

Builds: design 47 G A-476 (a), (b), (c)
2026-11-17 20:20:45 +01:00
mesh-tools 0adcfbbbdb Merge pull request 'A-471: a build toolchain is agreed by its language version, not its patch' (#248) from fix/a471-toolchain-language-version into main 2026-11-17 14:56:46 +00:00
jschoubben 109a3e1e49 A-471: buildrun and refusal texts name the language version
buildrun tests expect the agreed toolchain as ToolchainAgreement gives it; the guard's
refusal and a decline name the language version alone.

Builds: design 47 G A-471 (G-22-lead-answers-2.md)
2026-11-17 15:53:05 +01:00
jschoubben a66583236a A-471: a toolchain is agreed, reported and named by its language version alone
A build node whose installed patch differs from the ask's takes the ask: one shared
comparison in mesh-delivery-sdk buildstep (LanguageVersion, SameToolchainVersion),
used by the agreement (indexer, builder, checker), a build node's step guard and ask
check, and the builder's digest list. A fingerprint names the language version, so
every module's fingerprint changes once.

Builds: design 47 G A-471 (G-22-lead-answers-2.md)
2026-11-17 15:53:05 +01:00
mesh-tools 80a7061efa Merge pull request 'G-24 tests on main: the assigner hears presence once; grants composes each module's consumer from its own subjects' (#247) from fix/g24-tests-on-main into main 2026-11-17 14:35:31 +00:00
jschoubben 10d87dcc77 mesh-grants: a module's consumer is composed from its own subjects, not from its account's wide grant
ConsumerFor drew its filters from PermissionsFor, which since every account may subscribe to every subject (e1476cfd) is ">": no filter
named an event, so no module got an account consumer on EVENTS. The scoped permissions give them again. The integration subtests that
read each account's own subjects run with the wide grant off, as the unit tests do.

Builds: design 47 G A-434 (G-22-lead-answers-2.md: every account may do everything, the mechanisms stay whole), the grants part's account consumers (ADR 0561 §6)
2026-11-17 15:31:00 +01:00
mesh-tools 1cd984a4c7 Merge pull request 'A-473: the builder asks the tagged publish of a reserved version when its build ends' (#246) from fix/a473-builder-publishes-at-build-end into main 2026-11-17 14:09:34 +00:00
jschoubben b31924a2f5 A-473: the builder asks the tagged publish of a reserved version when its build ends
Reserved build ends (built-at set, every digest known) now queue that version at each
artifact's registry seat holder and drain it, as a holder's running does.

Builds: design 47 G A-473 (design 51 Publishing, A-417)
2026-11-17 15:06:38 +01:00
mesh-tools 7654838182 Merge pull request 'A-472: a pipeline's end waits on no other part' (#245) from fix/a472-runner-end-waits-on-nothing into main 2026-11-17 14:00:25 +00:00
jschoubben 3f51d83147 Runner: widens-read-bound and revisions-kept are the module's settings (A-472a)
Declared in module.json's config and written to state files as test-step-bound is; runner_cancel keeps its note.

Builds: design 47 G A-472a
2026-11-17 14:59:25 +01:00
jschoubben 0be2b3d01a assigner: the watchman's machine-away and machine-back have one hearer, the world's, so a durable on their streams no longer splits them
The composition step's own hub handler for machine-away and machine-back shared the durable of hearDelivery on the kept streams, so
each event went to one of the two and a machine away was often not known away to the delivery judge. The step now asks the world.

Builds: design 47 G §389, §64
2026-11-17 14:57:12 +01:00
jschoubben 871f75acd3 Runner: a pipeline's end waits on no other part (A-472)
The runner keeps each catalog revision it read, bounds every read widens makes to 5 s and says each read's duration, failure or cut in the journal and in could-not-run; runner_cancel reads the pipeline after an ask that did not answer.

Builds: design 47 G A-472
2026-11-17 14:55:27 +01:00
mesh-tools 4b75791d3d Merge pull request 'G-24: one composition run per candidate and machine, one test run per level, every reading step timed' (#244) from fix/47-G-shared-runs into main 2026-11-17 12:15:35 +00:00
jschoubben 4205f63786 Merge branch 'fix/47-G-shared-runs-watchman' into fix/47-G-shared-runs 2026-11-17 13:14:44 +01:00
jschoubben 2438f4a108 Merge branch 'fix/47-G-shared-runs-runner' into fix/47-G-shared-runs 2026-11-17 13:14:44 +01:00
jschoubben 9081966682 assigner: a case holding that a take-up says an end again under the open run's ask, a first end under the ask's id (A-470q)
Builds: design 47 G §719; A-470q.
2026-11-17 13:12:57 +01:00
jschoubben 16cb874ccc watchman: the integration test proves the end of a run's ask begins a test step's clock again (W1)
Builds: design 47 G-24 §732, §733 (watchman case)
2026-11-17 13:10:25 +01:00
jschoubben 20d6a68bfb assigner: a reader that leaves a run not yet taken, or whose place a rerun takes, has its wait ended superseded at once (A-470u)
Builds: design 47 G §727, §723; A-469y, A-470u.
2026-11-17 13:09:18 +01:00
jschoubben 21bef6c044 assigner: a drop ends each reader whose end is owed, once, and moves no reader (A-470r)
A carried reader that ended passed keeps its verdict; a reader marked rerun is ended by the drop alone, not again by the run's
move.

Builds: design 47 G §728; A-470r, A-470m.
2026-11-17 13:07:21 +01:00
jschoubben ae105b4631 runner: test 109 reads a step's end said again from EVENTS through a durable consumer
The runner keeps no message id on its step events (A-470t), so the bus's deduplication drops no end
said again (A-470q); test 109 now reads the tools' unit step-ended from the stream through a durable
consumer, its first end failed and the end said again by the move passed, both kept.

Builds: design 47 G §727; A-470d, A-470q, A-470t
2026-11-17 13:06:46 +01:00
jschoubben b58a8b2e7f assigner: an end said again is published under a message id naming the run that makes it say again, so the bus never drops it (A-470q)
A move names the moved run's ask, a take-up of a reader that ended the open run's, a drop the dropped run's; a first end keeps
the ask's id. Test 108 reads the ends through a durable consumer, as the runner hears them.

Builds: design 47 G §727; A-470d, A-470q.
2026-11-17 13:06:36 +01:00
jschoubben 533a076eb3 runner: test 109 asserts a queued ask has no bound in the state bounds
The case of a test run waiting with its holder present was asserted just after placing, so a
five-minute bound put back on the ask failed no test; test 109 now reads the state bounds after the
asks are put and holds only drops' keys there.

Builds: design 47 G §647 (as A-466y amends it), §535
2026-11-17 13:05:11 +01:00
jschoubben 4e33533bd0 assigner: a case holding that an end names its run's ask, so a replaced run's late end ends nothing (A-470n)
Builds: design 47 G §719; A-470n.
2026-11-17 13:04:19 +01:00
jschoubben 1f344bd47c assigner: a step asked again that joins a run not yet taken says its wait held, as join does (A-469y)
Builds: design 47 G §727; A-469y.
2026-11-17 13:04:02 +01:00
jschoubben 5b8fa23a8d watchman: the integration test seeds steps through the runner's stands verb; its findings name the runner's verbs (W1)
Builds: design 47 G-24 §731, §732, §733 (watchman case); A-469p
2026-11-17 13:03:57 +01:00
jschoubben ed78003b23 assigner: a composition reader names when its step said its end, so a take-up says no end again for a carried reader that passed (A-470l, A-470m)
The step's end, once said, is written on its reader in each run of its candidate naming it, by compare-and-set; a rerun's run
carries it with the reader; the take-up at the start skips a reader that ended and is not marked rerun.

Builds: design 47 G §719, §727; A-470l, A-470m.
2026-11-17 12:50:38 +01:00
jschoubben 20e966b9cd contracts: a composition reader names when its step ended, so a take-up tells a reader that passed from one that joined later (A-470m)
Builds: design 47 G §719; A-470l, A-470m. Generated by seatgen from the mesh-wants definition.
2026-11-17 12:47:39 +01:00
jschoubben 7697ef5988 assigner: a run's bound holds its ask, armed by compare-and-set, and its end comes before the input's delete (A-470n, A-470o, A-470p)
A bound was armed by a delete and a create with no revision, holding nothing, so a late ask-taken or
step-progress of a replaced run armed a clock that later ended the run asked next, and an expiry heard
after the bound was armed again ended a run that kept saying progress. A bound key now holds its run's
ask, published at the key's latest revision with its own time to live, and is deleted at its own
revision when the run read again no longer names that ask; a late signal moves nothing and is
journaled; an expiry ends the run only while its bound is still absent when read again and the run is
taken (bound.) or untaken (untaken.), the untaken expiry's readers said superseded as the key is gone.
A step-ended's run end is written before the kept input is deleted; a failed delete asks the event
again, whose redelivery finds the run ended and still deletes the input.

Builds: design 47 G §720, §719; A-470n, A-470o, A-470p
2026-11-17 12:39:12 +01:00
jschoubben 768213b816 Merge branch 'fix/47-G-shared-runs-watchman' into fix/47-G-shared-runs 2026-11-17 12:30:47 +01:00
jschoubben f9dd20e86d Merge branch 'fix/47-G-shared-runs-runner' into fix/47-G-shared-runs 2026-11-17 12:30:47 +01:00
jschoubben a96f873e21 runner: test 109, the test runs whole against the real bus
The runner whole against an embedded bus: one unit and one integration run per level read by both
artifacts, a failing run counted once, a rerun moving the other reader and not the accepted one, a
restart's take-up, progress past the bound, a replaced reader, a silent ask ending could not run with
its readers and its ask dropped, a second revision's own runs, a seat with no holder failing its
pipeline at once with its other steps not asked, test-runs and test-runs-drop over the bus, and the cap.
The finding writer's stream is hosted, as on the mesh.

Builds: design 47 G §733, §724, §725, §726, §727, §728, §535, §647; A-468f, A-470f, A-470g, A-470h, A-470i, A-470n
2026-11-17 12:30:19 +01:00
jschoubben ab9d9604b4 runner: a run's bound holds its ask, armed by compare-and-set, and its end is written before the step's finding (A-470n, A-470o)
A bound was armed by a delete and a create with no revision, so a late ask-taken or step-progress of a
replaced run could arm a clock for the run asked next, an expiry heard after the bound was armed again
ended the run, and a step-ended's run end waited behind its finding's event (3 s in test 109, past its
bound). A bound key now holds the run's ask and is published at the key's latest revision with its own
time to live, read against the run after it is written and deleted at its own revision when the run no
longer names that ask; a late signal moves nothing and is journaled; an expiry ends the run only while
its bound is still absent when read again; the run's end is written as its step-ended is heard, before
the finding.

Builds: design 47 G §720, §725, §726; A-470n, A-470o
2026-11-17 12:28:26 +01:00
jschoubben 2a90323af3 runner: no write of a test run acts on a read made before its latest change
The age and test-runs-drop deleted a run's key whatever was written after their read, an expiry or the
last reader's leave ended whatever run the key held by then, a rerun answered a write between its read
and its write as an error, and a step-progress heard as its run ended wrote a clock that later ended
the run asked next. A delete of test-runs is now a compare-and-set at the revision read, retried from
the latest read; a run's end ends only the run under the ask its caller judged; the last reader ends
the run in its own leave; a rerun writes its new run from the latest read; a clock is read against the
run after it is written, and a clock of a run not taken ends nothing.

Builds: design 47 G §725, §726, §727, §728; A-469l, A-469z, A-470d
2026-11-17 12:23:40 +01:00
jschoubben 00e1588ef9 assigner: no delete of composition-runs lands on a value newer than the one it judged
Every value write of the state was already a compare-and-set from the latest revision, retried on
conflict; the deletes were not. The sweep and the drop deleted a run's key whatever it held, so a
rerun's run replacing the key between the read and the delete was lost; the end of a run, the
ask-taken and a rerun deleted bound keys a newer run of the key may have armed. Each delete is now
at the revision just read, while the key holds the run it was judged from, judged again on a
conflict (the kind the runner's test 109 met in test-runs).

Builds: design 47 G §719 (readers added and removed by compare-and-set; the key deleted after composition-runs-kept), §720 (the bound keys)
2026-11-17 12:23:38 +01:00
jschoubben a439b8da47 runner: a carried reader with rerun false says no step-ended again at a take-up (A-470l)
The runner's take-up of a rerun's test run already ends only the readers marked rerun and the open
ones (endReader); this table case holds it there, so a reader that passed is never said again.

Builds: design 47 G §725 (take-up), §727; A-470d, A-470l
2026-11-17 12:16:01 +01:00
jschoubben a2f4e8b499 assigner: the running builds whose manifest is not read are said once per change of their set
The assigner said the same list of about 100 modules every two or three seconds, once per
pass (live on the stable node since 2026-11-17 11:02 CET, the second meeting); it now says
the list once each time it changes. Why their manifests cannot be read is the builder's
stream of build ends, which holds no end of a build made before 2026-11-11, said apart.

Builds: design 47 G G-23 (the assigner's long line, met a second time)
2026-11-17 12:11:38 +01:00
jschoubben 8e95c2486f assigner: a composition run's request names the revision's modules with no fingerprint (A-470j)
A module whose build can never be made left its machine not judged, so every step of the
candidate could not run; the case now carries none, the revision's words for each module it
gives no fingerprint, for the composer to blame that module alone.

Builds: design 47 G §721, §722; A-470j, A-470k
2026-11-17 12:08:44 +01:00
jschoubben 1878607208 assigner: test 108, the composition runs started whole against the bus
One test of the whole assigner: one run per candidate and machine read by every step, a
module's fault failing only its own steps, the bound of owed progress, the untaken ask, a
step-ended after the bound ignored, a rerun moving the reader that did not pass, a
superseded step leaving its run, a restart taking a run up by its ask, the drop verb and
the cap.

Builds: design 47 G §733 (test 108); A-470f
2026-11-17 12:07:56 +01:00
jschoubben 930a407a3a assigner: a composition run is found by the keys its state's watch handed, beside the listing
A bucket's listing misses a key that is being written at that moment (97 of 300 listings on
an embedded bus while one key was updated), so a run's end, its ask-taken or a moved reader
could miss the run being written. Every lookup of composition-runs now takes the keys the
state's own watch handed beside the listing.

Builds: design 47 G §719 (the assigner's own watch of its state), §720, §727; A-468, A-470d
2026-11-17 12:07:56 +01:00
jschoubben eadfcd4cf8 composer: a case names the modules the revision gives no fingerprint, with its none words (G-24 H3)
The assigner fills it from the revision; the node-engine's composer reads it alone to tell a build that can
never be made, and judges the machine with that module held instead of leaving it not judged.

Builds: design 47 G §721, §722, A-470j, A-470k
2026-11-17 12:01:12 +01:00
jschoubben 19fbc076d6 runner: test-runs is answered by the process, its fill said against test-runs-cap-mib (A-470g, A-470i)
The bundle said test-runs' fill against the bucket's 64 MiB ceiling, a cap that refuses nothing; the
process, which holds test-runs-cap-mib and judges it, now answers the verb test-runs, its fill's cap
being that setting, and runner_test_runs calls the verb.

Builds: design 47 G §728, §725 (the cap); A-469d, A-470g, A-470i
2026-11-17 12:00:35 +01:00
jschoubben 1a924f2ca7 runner: a seat with no holder ends its pipeline failed at once, its other steps not asked (A-470g, A-470h)
A pipeline with a step whose seat the seat-holders view names no holder for was failed only once its
other steps ended, after their asks ran for nothing; it now ends failed at placing, naming the seat,
with every other step not asked and said, and none of its steps asked.

Builds: design 47 G §32, §535, §647 (as A-466y and A-466z amend them); A-470g, A-470h
2026-11-17 11:58:25 +01:00
jschoubben ebe49b9bdd runner: a test run's steps are said waiting for a build node until the holder takes the run's ask (A-469b)
A test step queued on a build seat was said running, so the watchman's build-capacity waits never saw
it; every step of a test run now waits for a build node from the run's ask, and at the holder's
ask-taken each is said started again, running.

Builds: design 47 G §725, §732, §86; A-469b
2026-11-17 11:48:28 +01:00
jschoubben 7923ab63b1 runner: the test runs are read and dropped by the seat's verbs test-runs and test-runs-drop (R7)
A test run had no tool to read or recover it; test-runs answers each run with its packages from its
output object, or says the output gone, with the state's fill, and test-runs-drop, answered by the
process, records the hand act first, ends the readers naming the drop and deletes the key and its
object; runner_test_runs and runner_test_runs_drop call them.

Builds: design 47 G §728, §725 (the output object), §733 (unit); A-466v, A-469f, A-469g, A-469u, A-469v
2026-11-17 11:47:05 +01:00
jschoubben 09224d2cdf assigner: the composition runs are read and dropped through mesh-wants' verbs (A7)
A composition run must be seen and recoverable without a hand act on the bus: the seat
mesh-wants' verbs compositions and compositions-drop are answered by the process, the drop
recorded in the hand-act log first, its readers ended could not run naming it; the tools
assigner_compositions and assigner_compositions_drop call them.

Builds: design 47 G §728 (the assigner's two); A-469f, A-469u, A-469v
2026-11-17 11:46:29 +01:00
jschoubben 167a9f2818 assigner: a rerun of a composition step moves every reader that did not pass (A6)
Steps asked again together start one run per machine they did not pass: a rerun keeps the
verdict of a machine it passed, joins a running run, reads one it did not read, or starts
a new run carrying every former reader, those that did not pass marked rerun with the
caller; at the new run's end each marked reader says its end again, naming the new ask,
and a reader that passed does not move.

Builds: design 47 G §727 (composition part); A-468g, A-469l, A-470d, A-470e
2026-11-17 11:44:43 +01:00
jschoubben ad40520e89 runner: stands names a waiting step's ask and its run, and every step asked says step-started (R6)
The watchman could not time a step reading a run: stands named no ask, and step-started was said
only on rerun and ask-again. A waiting step now stands with its own ask and, for a test step, the
run's key and ask; each step asked at a start, a resume, a placing or a run says step-started,
naming its run in shared with no asker.

Builds: design 47 G §731, §729, §726 (step-started of a reading step); A-468e, A-469a, A-469q, A-469r, A-469v
2026-11-17 11:43:52 +01:00
jschoubben 2b3a9e4a6a runner: asking a test run again moves every reader that did not pass (R5)
A rerun of one artifact's failed test step left the other artifact's step failed on a result no
longer true; the rerun now joins, reads or starts the key's run, carrying the former readers
marked in the key, and the new run's end moves the marked ones, said again as a rerun by its
caller and naming the new ask, the pipeline reopened; an accepted step does not move.

Builds: design 47 G §727 (test part); A-469l, A-470d, A-470e
2026-11-17 11:42:09 +01:00
jschoubben 72ebb4deb6 runner: no holder is read from the seat-holders view, and an ask waits for its holder with no five-minute bound (R4)
A step queued for a present holder was ended failed after five minutes; the five-minute ask bound
goes, and a seat ends its steps could not run only when the seat mesh-module-assigner's view
seat-holders, followed from its first view on, names no holder for it.

Builds: design 47 G §535, §647 (as A-466y and A-466z amend them), §717 (the follower)
2026-11-17 11:38:22 +01:00
jschoubben d957a60286 assigner: a reading step names the runs it read, and a superseded step leaves them (A5)
A step's end and its progress name per machine the composition run and its ask, so a
result is traced to the one ask that made it; a superseded or cancelled pipeline's
composition step leaves the runs it reads, the run going on for its other readers, and a
run left with no reader drops its ask and ends could not run.

Builds: design 47 G §723, §729 (mesh-wants' step-ended and step-progress shared); A-469n, A-469t, A-469z
2026-11-17 11:38:10 +01:00
jschoubben ba11ff58dd assigner: a composition run's bound times owed progress, its untaken ask its own (A4)
A run whose build node stops saying progress, or whose ask no build node takes, would hold
its readers for ever: ask-taken arms bound.<run key> and each step-progress arms it again;
untaken.<run key> times the queue from the start, the readers said waiting for a build node
meanwhile; an expiry drops the ask and ends the run could not run naming the bound, and a
step-ended heard after it is ignored and journaled. Readers of a run left open at a restart
are taken up from the keys.

Builds: design 47 G §719 (take-up at start), §720 (the bound, when the clock ends, a run never taken, what the assigner hears); A-466q, A-466s, A-468, A-468b, A-469b, A-469s, A-469y, A-470
2026-11-17 11:36:15 +01:00
jschoubben 97f68b04ea runner: a test run's end moves every step reading it, counted once, dropped only with its last reader (R3)
The run's ask's end now ends each reading step with the run's outcome, counts and shared, its
output kept in test-runs-objects; a pipeline counts a run's tests once; a superseded or cancelled
step leaves the run, the last to leave dropping its ask and ending it; a composition step keeps
the runs mesh-wants names.

Builds: design 47 G §726, §725 (output object), §724 (an ended run read), §729; A-466i, A-468d, A-469m, A-469t, A-469z
2026-11-17 11:33:54 +01:00
jschoubben 61a11f8c15 assigner: a composition step judges each machine by the modules its verdict blames (A3)
One module's fault fails only its own pipelines: a machine blaming module A fails A's step
and passes B's with a warning naming A; a machine that blames none fails every step on it;
a composer before blamed is judged as before, saying it names no culprits; a module the
search did not try is could not run for its own step. Each request carries blame_tries.

Builds: design 47 G §721 (an old composer, its bound), §722; A-466r, A-468a, A-469h, A-470b
2026-11-17 11:32:19 +01:00
jschoubben cd08f1e1c2 runner: a test run is kept in the state test-runs with one clock, a cap and an age (R2)
A test run is now one key of test-runs: its untaken bound written at its start, its clock at
ask-taken and each step-progress, an expiry ending the run and every reader could not run and
dropping its ask, a run past its bound while the runner was away ended at its start, the cap
judged by the process, and an ended run aged with its output object in the step log's order.

Builds: design 47 G §725, §720 (When the clock ends, A run never taken); A-466n, A-466p, A-466s, A-468b, A-468c, A-469d, A-469e, A-469w, A-469x, A-470, A-470a
2026-11-17 11:31:26 +01:00
jschoubben afa95fd0df assigner: one composition run per candidate and machine, every step reading it (A2)
The steps of one candidate share a machine's run, so a revision of 24 pipelines composes
each machine once: the step that starts a run asks the node's input, keeps one request,
chooses and records the composer program, and puts one run ask; every other step reads
the run's verdict from its key, its end written there from the build seat's step-ended.

Builds: design 47 G §718, §719, §720 (within its candidate only, could not run is never read); A-468, A-468a
2026-11-17 11:31:05 +01:00
jschoubben ef5e5d13e0 assigner: the state composition-runs, one key per candidate and machine (A1)
A composition run is kept once per candidate and machine, so steps of one candidate share
it: the key is written create-only, a reader is the step's StepRun with its ask id, a run
that could not run is replaced, a run past composition-runs-kept goes at the next start,
and at the cap no run starts, naming the fill. The settings reach the process through
resource files.

Builds: design 47 G §718, §719, §720 (could not run is never read); A-468, A-468b, A-468c, A-469d, A-469w, A-469x, A-470
2026-11-17 11:26:51 +01:00
jschoubben 5388bbce43 runner: a test step is asked once per candidate, level and share digest, the others read it (R1)
Two artifacts of one directory ran the same tests twice and failed them twice; the first step of
a test-runs key now asks the run, written create-only, and every other step of the candidate reads it.

Builds: design 47 G §724, §725 (the key), §730; A-468k, A-469c, A-469m, A-469q
2026-11-17 11:22:55 +01:00
jschoubben 185fe0ae1d watchman: times every step that reads a run, seeded from the runner's stands (W1)
The watchman keeps each started step under <pipeline>/<step>/<artifact>, begins
its clock at step-started and at each mesh-wants step-progress, build seat
step-progress or step-ended of the step's ask or an ask its shared names, raises
pipeline-stands past five minutes, clears it at the step's step-ended, owes none
to a step on a person or queued for a build node, and seeds from stands at start.

Builds: design 47 G-24 §731, §732, §733 (watchman case); A-468j, A-469, A-469o, A-469p, A-469t, A-469r
2026-11-17 11:20:22 +01:00
jschoubben 8fa1b8aee7 contracts: shared on a step's end and progress, ask and shared on stands, the four run verbs (C1)
A step that read a composition run or a test run names it in shared, so the result is
traced to the one ask that made it; stands names what a reading step waits on; the
runs' read and drop are seat verbs with their class (seatgen regenerated, no hand edit).

Builds: design 47 G §728, §729, §731; A-468d, A-468e, A-469f, A-469q, A-469r, A-469t, A-469u, A-469v
2026-11-17 11:15:55 +01:00
jschoubben c17ccd3070 composer: a request carries blame_tries, a machine's verdict names the modules it blames (K1)
The assigner bounds the composer's culprit search through the request, since the composer program has no settings; a
verdict always writes blamed, an empty list when it blames none, so an old composer's absent field stays tellable.

Builds: design 47 G §721, §729; A-469h, A-469i
2026-11-17 11:10:46 +01:00
jschoubben 9849c49920 assigner: the key form of the state inputs is the assigner's own; an ask's key holds digest and time (A-465b)
The state inputs leaves the seat mesh-wants' definition (seatgen regenerated, no hand
edit). An ask's key holds {digest, at}; the sweep deletes an ask's key a day after its
time and an input with its object once no ask's key names it; keys of the old form
<time>.<digest> go by the time they carry, never earlier.

Builds: design 47 G A-465a, A-465b
2026-11-17 11:05:12 +01:00
jschoubben 4cdf14680e assigner: a composition input is kept once per content, by its sha256 (A-465a)
The key of the state inputs is the digest alone (seat mesh-wants' key form <digest>);
each ask's name holds the digest, the input and its object end with the last ask that
names it or a day after its last write (at.<digest>); the contract files of the seat are
edited by hand (generator not found).

Builds: design 47 G A-465a
2026-11-17 11:05:12 +01:00
mesh-tools bf5f794553 Merge pull request 'assigner: a composition step with no machine judged never passes (A-467a)' (#243) from fix/47-G-composition-none-judged into main 2026-11-17 09:49:30 +00:00
jschoubben 34da4fe001 assigner: a composition step with no machine judged ends could not run (A-467a)
A step whose every machine is away never passes: it ends could not run, naming each machine and why. An away machine is still
not asked and still said as a warning when another machine is judged.

Builds: design 47 G A-467a, A-467
2026-11-17 10:49:05 +01:00
mesh-tools 2406bb4000 Merge pull request 'assigner: a composition step never passes on a machine it did not judge (A-467)' (#242) from fix/47-G-composition-judges into main 2026-11-17 09:47:26 +00:00
jschoubben db62653472 assigner: a composition step never passes on a machine it did not judge, and hands the composer the trunk seat list (A-467)
A machine the composer says `not judged` ends the step could not run, naming why (was a warning). A revision that names no seat
definition (A-234's stand-in) hands the composer every definition of the trunk seat list, read through mesh-catalog's
seat-definitions; a list or definition not read ends the step could not run, naming it (was an empty list, no error). The
integration bed makes the inputs object store, which a request carrying the seat list needs.

Builds: design 47 G A-467, A-234, A-252, A-261
2026-11-17 10:45:20 +01:00
mesh-tools 6bb6452603 Merge pull request 'pipeline runner: a step-log read never waits for a batch it cannot fill' (#241) from fix/47-G-runner-ends into main 2026-11-17 09:40:11 +00:00
jschoubben 8d93c3ff9f Pipeline runner: the ageing reads the step log without waiting for a batch the log cannot fill
Every step's end waited 2 s per retention (6 s) in the step log's Fetch when fewer than 20 entries lay past the aged pointer, so ends were taken one in 6 s serially.

Builds: design 47 G §330 (ageing of the runner's own data at each step's end)
2026-11-17 10:38:13 +01:00
mesh-tools f93e8b9750 Merge pull request 'indexer test: seed a want and a running build before an entry may be removed' (#240) from fix/47-G-integration-tests into main 2026-11-17 08:44:59 +00:00
jschoubben 9a8609f770 Indexer test: seed a want and a running build, since no entry is removed before both streams read non-empty
Builds: design 47 G §675 (kept while named)
2026-11-17 09:43:05 +01:00
mesh-tools 39162a4435 Merge pull request 'assigner: composition inputs end with their objects; assigner_inputs_drop (A-465)' (#239) from fix/47-G-inputs-objects into main 2026-11-17 08:23:36 +00:00
jschoubben 1ccde6fc3e assigner: assigner_inputs says when the key-gone objects cannot be listed; the start's drop is asserted (A-465)
Builds: design 47 G-22 A-465
2026-11-17 09:22:14 +01:00
jschoubben 45f7bf8e01 assigner: an input the assigner ends ends its object too; the objects of deleted keys go at the start and by assigner_inputs_drop (A-465)
Builds: design 47 G-22 A-465
2026-11-17 09:02:34 +01:00
mesh-tools eed0833a29 Merge pull request 'indexer: take in a merge it never took in, and read takeins (A-463, A-463a, A-464a)' (#238) from fix/47-G-untaken-merge into main 2026-11-17 01:13:06 +00:00
jschoubben 223b096295 indexer: a head the pending holds is not behind; a revision heard during a catch-up is compared after it (A-463a)
Builds: design 47 G-22 A-463a, A-463
2026-11-17 02:10:17 +01:00
jschoubben 1987a3915e indexer: correct the comment on movedPackages, which A-464 made untrue
Builds: design 47 G-22 A-464
2026-11-17 02:02:12 +01:00
jschoubben 250a0f1b12 indexer: take in a merge it never took in, and say so while it is behind (A-463)
At its start and on every source revision the indexer compares each repository's taken merge with the head the gate's source names; a repository behind is taken in as its merged message would have been, with the finding merge-untaken raised until it is.

Builds: design 47 G-22 A-463
2026-11-17 01:55:46 +01:00
jschoubben 61843f823d indexer: the tool indexer_read_takeins reads the state takeins (A-464a)
Builds: design 47 G-22 A-464a
2026-11-17 01:55:46 +01:00
mesh-tools 44bdbbcbed Merge pull request 'assigner: a backup ask only for a failed backup (A-453, A-453a)' (#237) from fix/47-G-backup-ask-only-for-failed-backup into main 2026-11-16 23:51:25 +00:00
jschoubben 482a618d1e assigner: a held have names the build it keeps running; only a have not held at another fingerprint is past the hold (A-453a)
Builds: design 47 G A-453, A-453a, ADR 0539 §16
2026-11-17 00:49:26 +01:00
jschoubben 1a187445a5 assigner: a backup ask stands while its have is mid-move; it goes only past the hold (A-453a)
Builds: design 47 G A-453, A-453a, ADR 0539 §16
2026-11-17 00:46:47 +01:00
jschoubben 8ab75bb727 assigner: the backup question is asked only for a held have with no wait (A-453)
A held have that carries a wait is a hold of the composition, not a failed backup; a backup ask whose have now carries a wait or is no longer held is withdrawn with its condition.

Builds: design 47 G A-453, ADR 0539 §16, §541
2026-11-17 00:41:00 +01:00
mesh-tools 8c4489fb3d Merge pull request 'assigner: its calls wait 3 minutes, so a node composing a candidate is answered' (#236) from fix/assigner-waits-for-composing into main 2026-11-16 22:41:19 +00:00
jschoubben a2bcb23f0e assigner: its calls wait 3 minutes, so a node composing a candidate is answered
compose-candidate composes a whole revision in shadow on each node and
answered in about 34 s on g14 and shanks (2026-11-16 23:27), past the
SDK's 30 s call bound, so node-tools' composition step could not run. A
responder that is absent still answers at once. Quick fix; the thorough
one is a bound per verb from the seat's definition (after G).
2026-11-16 23:41:01 +01:00
mesh-tools 43050bf20a Merge pull request 'Pipeline runner tools: runner_rerun, the runner's rerun is reachable as a tool' (#235) from feat/runner-rerun-tool into main 2026-11-16 22:34:16 +00:00
jschoubben 8710148ce0 Pipeline runner tools: runner_rerun, the runner's rerun is reachable as a tool
main.981.node-tools passed build, lint, unit and integration; only its
composition step could not run (g14 and shanks composed in about 34 s,
past the assigner's 30 s, while shanks ran the pipeline's own tests).
The seat verb rerun asks one step again, but no tool reached it.

Builds: design 47 G §482
2026-11-16 23:33:57 +01:00
mesh-tools 6618925841 Merge pull request 'Hand acts name their cause: the runner's write verbs and the checker's requests drop' (#234) from fix/hand-acts-name-their-cause into main 2026-11-16 22:13:04 +00:00
jschoubben 1eb090d407 hand acts name their cause: the runner's write verbs and the checker's requests drop
mesh-hand-acts 0.1.13 refuses a hand act with no cause; the pipeline
runner's record (cancel, rerun, accept, run, ask-again, review, start) and
the checker tools' requests drop gave none, so every one was refused and
nothing was done (runner_cancel, 2026-11-16 23:12: 96 of 96 refused). The
cause is the verb's own word, the one a second act for the same reason uses.
2026-11-16 23:12:51 +01:00
mesh-tools f373cf4ae6 Merge pull request 'Pipeline runner tools: runner_cancel, the runner's cancel is reachable as a tool' (#233) from fix/pipeline-runner-ends-stale into main 2026-11-16 22:05:02 +00:00
jschoubben e040cc5fc2 Pipeline runner tools: runner_cancel, the runner's cancel is reachable as a tool
Builds: design 47 G §482 (cancel)
2026-11-16 23:04:07 +01:00
mesh-tools 38f1c2f10a Merge pull request 'assigner: a composition step reads its catalog revision once and again on a timeout' (#232) from fix/composition-reads-revision-once into main 2026-11-16 20:32:07 +00:00
jschoubben bece2421f1 assigner: a composition step reads its catalog revision once and again on a timeout
Builds: design 47 G §354, A-252, A-261
2026-11-16 21:31:34 +01:00
mesh-tools fb257f549b Merge pull request 'pipeline runner: a pipeline for every module whose fingerprint has none, on a take-in and at start-up' (#231) from fix/pipelines-for-every-moved-module into main 2026-11-16 20:15:27 +00:00
jschoubben b9c50ef0c5 pipeline runner: a pipeline for every module whose fingerprint has none, on a take-in and at start-up
A batched take-in names only its newest revision's movers; the other modules it moved never got a pipeline.
Starter.TakenIn and the runner's first-half pickup now start one for each module of the branch's head with no pipeline at its fingerprint.

Builds: design 47 G §44, §54, §88, §476
2026-11-16 21:14:46 +01:00
mesh-tools f7e0619b24 Merge pull request 'indexer: no catalog graph entry is removed before what is wanted and running was read in full' (#230) from fix/indexer-graph-removal-needs-full-read into main 2026-11-16 19:56:34 +00:00
mesh-tools d351ec5932 Merge pull request 'teller: hold an answer's warrant to the ask as the channel was asked it' (#229) from fix/teller-short-words-warrant into main 2026-11-16 19:21:28 +00:00
jschoubben 4eef3e6c4d teller: hold an answer's warrant to the ask as the channel was asked it, its words cut
#228 cut long hexadecimal runs from an assigner ask's words but checked the warrant against the assigner's whole words:
the operator's answer to mesh-hand-acts' backup ask on novox (20:19) was refused as no longer the ask answered.
2026-11-16 20:21:17 +01:00
mesh-tools 92c87aac6c Merge pull request 'teller: cut long hexadecimal runs from an assigner ask's words' (#228) from fix/teller-short-fingerprints into main 2026-11-16 19:15:43 +00:00
jschoubben 34310504b5 teller: cut long hexadecimal runs from an assigner ask's words, so the operator channel does not refuse it as a secret
The backup ask of mesh-hand-acts on novox (2026-11-16 19:53) carried the node-engine's whole fingerprints and was refused
by the channel; nothing reached the operator and the module stayed held.
2026-11-16 20:15:19 +01:00
jschoubben 5188d36a5c indexer: no catalog graph entry is removed before what is wanted and running was read in full
Builds: design 47 G §675 (kept while named). A start read that ended with a stream empty, or with an event whose set was not
written, leaves the sets not ready; an entry is also kept when a heard want or running build names it though its set key is
missing; a removal says how many wants and running builds it read.
2026-11-16 20:03:19 +01:00
mesh-tools bfea3d36ad Merge pull request 'assigner: a want held at an older build names that build's release while the trunk's fingerprint has no passed pipeline' (#227) from fix/assigner-want-older-build into main 2026-11-16 18:51:38 +00:00
jschoubben 592278441c assigner: a want held at an older build names that build's release while the trunk's fingerprint has no passed pipeline
novox 2026-11-16: mesh-hand-acts' want stayed at 4eb3cf48 with no version because the pass returned at
no-passed-pipeline before it named a build. Now each held want without a version, at a fingerprint other than the
trunk's, takes the release whose parts that build made (and parts where its engine reads them); nothing else changes.

Builds: design 47 G §379, §526 (A-96, A-421, A-430a)
2026-11-16 19:50:45 +01:00
mesh-tools 48ba977270 Merge pull request 'assigner: a want held at an older build names that build's release by its parts' (#226) from fix/assigner-held-build-release into main 2026-11-16 17:53:02 +00:00
jschoubben 8671d1062b assigner: a want held at an older build names that build's release by its parts
novox 2026-11-16 18:46: the mesh-sdk merge moved mesh-hand-acts' fingerprint to 9b3a5534; rule 2 holds the want at
4eb3cf48 (no pipeline passed at the new one), and namedBuild named a release only for the trunk's fingerprint, so the
held want never got version 0.1.13 though it was released at 18:04:46. Now a held build takes the release whose parts
are exactly what it made (A-421's match).

Quick fix = thorough fix here: namedBuild is the one place a want's release is looked up.
2026-11-16 18:52:50 +01:00
mesh-tools 7c3b6211b0 Merge pull request 'assigner: name a release by its parts when its source is not the entry's fp-src' (#225) from fix/assigner-release-by-parts into main 2026-11-16 17:07:26 +00:00
jschoubben cd6a452c08 assigner: name a release by its parts when its source is not the entry's fp-src
novox 2026-11-16: mesh-hand-acts 0.1.13 was released from source 962 (the builder's reservation), its catalog entry's
fp-src is 963, so the assigner found no release and the want on novox named no version and no parts. When no release of
the fp-src is heard, the release whose parts are exactly the digests this fingerprint's build made is this build's (A-421's
match, extended).

Quick fix (this): the assigner matches by parts, which are the evidence. Thorough fix (noted, not here): the builder's
reservation records the entry's fp-src as its source, so both name the same revision.
2026-11-16 18:07:17 +01:00
mesh-tools 7b71766ab4 Merge pull request 'builder: drain every holder a publish again queued at, whatever a later version met' (#224) from fix/builder-drain-after-entry-error into main 2026-11-16 16:55:24 +00:00
jschoubben a90c4bfbf5 builder: drain every holder a publish again queued at, whatever a later version met
queue() returned on the first version whose catalog entry could not be read, before it started the drain of the
holders it had already queued at: on 2026-11-16 17:20 mesh-hand-acts 0.1.13 was queued at distribution, then
mesh-delivery-indexer 0.1.14's entry was not kept, and the queued publish was never sent, so no version was
released. Now an unreadable entry leaves only its own version unqueued, the error is still answered (heard again),
and the drain of every holder given a version is started in all cases (design 47 G section 588).

Quick fix and thorough fix are the same here: queue() is the one place that starts a holder's drain.
2026-11-16 17:55:06 +01:00
mesh-tools cdcab2370d Merge pull request 'mesh-grants: a grant waits only for what the loaded list does not allow' (#223) from fix/grants-waits-by-coverage into main 2026-11-16 16:30:42 +00:00
jschoubben 30f67f0471 mesh-grants: a grant waits only for what the loaded list does not allow
GrantWaits compared permissions by their text, so a composed subject or allow-responses counted as
missing though the loaded list's '>' already allowed it: all 182 grants waited on '1 permissions'
from 15:43 on 2026-11-16 and no want moved. A subject a loaded one covers is carried now, and
answering is carried where the loaded user may publish every subject.
2026-11-16 17:30:29 +01:00
mesh-tools 28b5724871 Merge pull request 'mesh-grants: say what each pass did with the grants' (#222) from fix/grants-pass-says-its-grants into main 2026-11-16 16:26:07 +00:00
jschoubben 298f4de168 mesh-grants: say what each pass did with the grants
A grant held (kept or waiting) or left out was read only from the pass object, which no tool opens,
and the assigner's sixth rule waited on it in silence: no grant for any module was written after
15:43 on 2026-11-16 and nothing said why. Each pass now says its grants: wanted, written, deleted,
and every kept, waiting and missing one with its reason.
2026-11-16 17:25:49 +01:00
mesh-tools bf2962dc29 Merge pull request 'Assigner: bind the kept seat events, so a composition run's end is heard' (#221) from fix/assigner-hears-kept-step-ends into main 2026-11-16 15:04:19 +00:00
jschoubben c1fc670af4 Assigner: bind the kept seat events, so a composition run's end is heard
The build seats' step-ended is a kept seat event on its own stream, never on EVENTS. The assigner
registered its handler on the hub but never bound the kept streams, so every composition step
waited for ever after its composer run passed (pipeline main.961.mesh-hand-acts, 2026-11-16).
Design 47 G §354, A-240.
2026-11-16 16:03:59 +01:00
mesh-tools 91b65d0180 Merge pull request 'Indexer: an input leaves nothing in its object store; a full store is said by name and fill' (#220) from fix/indexer-inputs-retention into main 2026-11-16 14:39:19 +00:00
jschoubben ac0befa9b9 Indexer: an input leaves nothing in its object store; a full store is said by name and fill
The indexer's inputs-objects bucket filled twice: deleting an input's key (step-ended, the day sweep)
left its object, which only the person's drop tool removed. The input's key and object now go together,
each write first drops the objects no key names, and a write the store refuses names the store and its fill.

Builds: design 47 G §354, §712, A-237
2026-11-16 15:31:26 +01:00
mesh-tools 4fabf9d26c Merge pull request 'G starts: grants composes the first rights from the trunk, the indexer answers at once and knows its build, unpublished packages build at the source commit' (#217) from fix/47-G-start-2 into main 2026-11-16 14:15:12 +00:00
jschoubben 3d5ea26605 Merge branch 'fix/447-builder-names-dir' into prep/delivery 2026-11-16 15:07:25 +01:00
jschoubben 10b879bc31 assigner: a machine whose node-engine is not heard running composes with the revision's node-engine entry, said (A-451)
Live, 2026-11-16: main.953's composition could not run, 'novox: no build of mesh-host is heard running there'.
2026-11-16 14:52:43 +01:00
jschoubben 00de5a7f43 assigner: comments of the chunked composition input cite A-237c
Builds: design 47 G (G-22 lead answers 2) A-237c; A-237b
2026-11-16 14:49:47 +01:00
jschoubben 0ee747cf1b assigner: the composition step takes a node's input through the chunked seat call, with a call token (A-237b)
Builds: design 47 G (G-22 lead answers 2) A-237b; A-237, A-249
2026-11-16 14:39:30 +01:00
jschoubben d69ee47321 indexer: a node-engine's call of the verb revision is proved as node.<machine> and stands for the module holding the seat node-engine (A-450)
Builds: design 47 G (G-22 lead answers 2) A-450; ADR 0621 §2, ADR 0663 §2
2026-11-16 14:13:31 +01:00
jschoubben 05c765e36d pipeline runner: the pipeline-ended is said, with its widens, before the pipeline's pin is freed (A-449)
Builds: design 47 G (G-22 lead answers 2) A-449
2026-11-16 14:02:25 +01:00
jschoubben 7c0b835ce3 assigner: the composition step builds its compose-candidate key with the node-engine client's builders (A-226b)
Builds: design 47 G (G-22 lead answers 2) A-226b
2026-11-16 13:59:29 +01:00
jschoubben c44a42fc16 indexer: a take-in reads and pins its revision holding keepMu, so no other keep removes it first (A-449a)
Builds: design 47 G (G-22 lead answers 2) A-449a; §579
2026-11-16 13:48:33 +01:00
jschoubben 5632924c4f pipeline runner and indexer: review fixes (advance only places waiting steps, view re-read after the starts, one freed) and the indexer pins a take-in's revision for its pipelines (A-448, A-449a)
Builds: design 47 G (G-22 lead answers 2) A-448, A-449, A-449a; §153, §200, §579
2026-11-16 13:46:17 +01:00
jschoubben bbcad0845a pipeline runner: a take-in's pipelines start at its own catalog revision, wait for the view, and pin the revision while they run (A-448, A-449)
Builds: design 47 G (G-22 lead answers 2) A-448, A-449; §153, §200, §476, §579
2026-11-16 13:38:57 +01:00
jschoubben d0efbee65b take-in.taken names the catalog graph revision the take-in made (A-448)
Builds: design 47 G (G-22 lead answers 2) A-448; §476, §493
2026-11-16 13:36:49 +01:00
jschoubben c5799d2f9b assigner: find the node-engine's entry by its served verbs in the catalog's seat: form (composition could never run) 2026-11-16 13:02:04 +01:00
jschoubben 19758f44cf pipeline runner: bind the kept seat events' streams, so a step's end is heard (G-1 §24) 2026-11-16 12:55:59 +01:00
jschoubben f5880d449b pipeline runner: a step's fetch always names its module's directory, paths when the entry has them (principle 10, A-447) 2026-11-16 12:22:52 +01:00
jschoubben d0e7dee951 Builder names the module's directory on every fetch; the fetch request accepts dir with no paths (A-447)
Builds: design 47 G (G-22 lead answers 2) A-447
2026-11-16 12:22:37 +01:00
jschoubben a5a5d9a16f A check for a module tests that module directory's modules alone (A-447c)
Builds: design 47 G (G-22 lead answers 2) A-447c
2026-11-16 11:37:54 +01:00
jschoubben 41821c841a Compose jobs of the checker name their module's directory in the fetch (A-447b)
Builds: design 47 G (G-22 lead answers 2) A-447b
2026-11-16 11:34:43 +01:00
jschoubben 017451762d Builder names the module's directory on every fetch; the fetch request accepts dir with no paths (A-447)
Builds: design 47 G (G-22 lead answers 2) A-447
2026-11-16 11:09:26 +01:00
jschoubben e7c05c5370 pipeline runner: say pipeline-started when placing a pipeline never asked; drop the runner version wait's leftovers
Placing the steps of a pipeline that has none says its pipeline-started, a
set-aside one included. The seat's acts entry for step `pipeline`, the wait step
value `pipeline` and the wait's `clock-from` go.

Builds: design 47 G A-446, A-446a
2026-11-16 10:36:19 +01:00
jschoubben 070a5dd35b pipeline runner: no pipeline is set aside for the runner's own new version
A take-in that changes the runner starts its pipelines as any take-in does; the
state bounds' held keys, the wait's `on` value `runner version`, the finding
pipeline-waits, the verb release (and the tools runner_release and runner_waits
that only served it), the Held field and the runner's build-end and running
hearing go. A pipeline a previous runner left set aside is placed and asked
at the runner's start as a newly started one.

Builds: design 47 G A-446 (replaces A-195, A-206, A-218, §266's hold)
2026-11-16 10:34:12 +01:00
jschoubben 57025ccb3b assigner: manifest test lists assigner_why; ask-operator-for description names its real default
Builds: design 47 G A-439 (assigner_why), A-425 (the ask-operator-for default)
2026-11-16 09:44:37 +01:00
jschoubben fb588e85c0 indexer: say the start replay's progress every 50000 entries, so a normal start does not fill the journal 2026-11-16 09:25:44 +01:00
jschoubben bfb80605c3 Merge remote-tracking branch 'origin/main' into fix/47-G-start-2 2026-11-16 09:25:11 +01:00
jschoubben e4302579ce indexer: each start step says when it begins and how long it took, and the build-end replay and package publishing say their progress, so a start that does not end is read in the journal 2026-11-16 02:13:58 +01:00
jschoubben 2979bc3b84 assigner: an ask's words cut each digest and fingerprint to 12 digits, so the router no longer refuses every backup ask as a secret; the backup ask binds its composition by that prefix 2026-11-16 01:25:22 +01:00
jschoubben 8f20ca8fdc assigner: a module wanted with no passed pipeline names the parts its build.ended made until its release is heard (design 47 G §16, A-428) 2026-11-16 00:19:35 +01:00
jschoubben e67f77f8e6 assigner: an online node runs its node-engine for an acting wait on the seat node-engine, whatever its have of itself says 2026-11-16 00:05:44 +01:00
jschoubben 7c338230de assigner: a part no running statement names is read from its have for an acting wait, on every node (A-426) 2026-11-16 00:02:55 +01:00
jschoubben 7548314b95 assigner: a have with no health counts as running for an acting wait where its engine states no running 2026-11-16 00:02:21 +01:00
jschoubben e78b3eea0a assigner: a node whose node-engine states no running is read from its have: a part running healthy there ends an acting wait (A-426) 2026-11-16 00:02:01 +01:00
jschoubben 7989ddc227 assigner: the holder of mesh-catalog is wanted with no passed pipeline: every pipeline runs on a revision it took in (design 47 G §16, G-5 whole test) 2026-11-15 23:57:14 +01:00
jschoubben 4abb853400 assigner: assigner_written with why answers the wants' whys until the manifest naming assigner_why is taken in 2026-11-15 23:54:17 +01:00
jschoubben bda4abb13e assigner: assigner_why says why a want is what it is: the pass step that decided it and what it read (tools rule) 2026-11-15 23:47:23 +01:00
jschoubben 63dff99f11 grants: no seat can lose its holder when every account subscribes to every subject
The list giving every account every subject was held at 23:20:32: the guard reads each seat's holders from the text of
the subjects users subscribe to, and > names no seat, so it saw every seat lose its holder.
2026-11-15 23:22:18 +01:00
jschoubben e1476cfdf9 grants: every mesh account may publish and subscribe on every subject
The operator, 2026-11-15 23:12 CET: the mesh accounts should have all the permissions, otherwise it becomes a mess;
the operator can do everything, always. Permissions derived per module refused the indexer's chunks, seat asks and
seat verbs again and again while G is delivered. The approval mark's and the desk's denies stay; an enrolling node
keeps its few subjects. The research after G replaces the accounts themselves (mesh, agent, operator).
2026-11-15 23:14:36 +01:00
jschoubben 7c33a2cf4c grants: a module's own account sends the chunks of a verb of a seat it holds (A-115)
The validation of mesh-delivery #219 failed twice: the indexer answered seat:mesh-catalog.input, and the bus refused
its chunks, since only an account whose process repeats the verb in serves was granted to send them. The indexer's
and the assigner's programs answer their seat's input verb on the module's own account; their claims say they serve it.
2026-11-15 22:40:36 +01:00
jschoubben 2682a623de grants: a module left out of the shadow list says why no manifest was found (the pass's gaps naming it) 2026-11-15 22:34:45 +01:00
jschoubben 7d97516c3b pipeline: a step's fetch names the module directory only with its artifact's paths
Every step of the first pipelines ended 'could not run (the request names a module directory and no path)': the runner put
the entry's directory in the fetch without paths, which the build seat refuses. It now names the directory with the
artifact's named paths from the entry, and else neither, so the commit is fetched whole.
2026-11-15 18:58:23 +01:00
jschoubben 485c2f10b1 grants: every account may receive a chunked verb's answer (principle 6)
The validation of mesh-delivery #219 failed: the check program on shanks asked seat:mesh-catalog.input, whose answer comes
in chunks, and the bus delivered none, since only an account naming the verb in invokes was granted its chunk subjects.
Inside the mesh any module may call any seat verb (the operator, 2026-11-15).
2026-11-15 18:51:42 +01:00
jschoubben bb164bb2b8 steprun: the line of an ask's end names a pipeline step's own outcome
An ask's end read 'passed' when its end was said, whatever the step's outcome: five pipeline steps read passed after 0 s
and nothing said whether they ran tests, carried them or had nothing to run (failure must be loud).
2026-11-15 18:50:49 +01:00
mesh-tools 479b5b5521 Merge pull request 'takein: require the meshcatalog contract its taken event now carries' (#219) from fix/47-G-takein-requires-meshcatalog into main 2026-11-15 17:47:33 +00:00
jschoubben 7d6eeed8ae takein: require the meshcatalog contract its taken event now carries 2026-11-15 18:47:25 +01:00
jschoubben 16517579b2 takein: require the meshcatalog contract its taken event now carries
The check of 901c800c failed: modules/mesh-delivery-indexer/takein imports seats/meshcatalog for TakeInEntry (#218) and
its go.mod did not name it, so a shut-off step could not build it.
2026-11-15 18:47:24 +01:00
jschoubben 4289d5583b grants: the part's account may create the seats' ask streams it makes
The bus refused SEAT_MESH_BUILDS's and SEAT_MESH_WANTS's create: the part's account is granted each stream it creates by
name, and the ask streams were not named. They join the declared streams, as the kept-event streams do.
2026-11-15 18:36:55 +01:00
jschoubben 773f89e9de steprun: the build seats' queue kinds take turns
A build module pulled a waiting delivery before any check, so 89 queued deliveries held every pipeline's check back on
shanks for an hour and more. The pull now starts at the kind after the one its last ask came from; neither kind starves
the other (the operator's yes, 2026-11-15).
2026-11-15 18:33:37 +01:00
jschoubben fe3bdb5d10 grants: make each seat's ask stream the bus lacks, from the seat list
The pipeline runner's step ask to mesh-builds timed out: it publishes on the seat's accept subject through JetStream and
no stream held mesh.seat.mesh-builds.accept.>. Before G the controller made SEAT_<SEAT> for every seat that accepts work;
the seats whose queues came with G (mesh-builds, mesh-wants) had none. The grants part now makes each such stream, from
the seat list, at every pass, as it makes the seats' kept-event streams: only where the bus holds none.
2026-11-15 18:30:47 +01:00
jschoubben 6b5099c8d7 grants: every module account may put an ask on any seat (principle 6)
The bus refused the indexer's validation ask and the pipeline runner's step asks: a named ask was granted only from the
seat definition's callers and a composed manifest, and both accounts were kept from the list in force without them. The
operator, 2026-11-15 about 18:10 CET: no fine-grained permissions inside the mesh; every account of a module, its
processes, its node and the tool runner is granted mesh.seat.*.accept.>, composed or kept. A seat's events and verbs keep
their own rules until the research after G decides the whole shape.
2026-11-15 18:19:03 +01:00
mesh-tools 901c800c62 Merge pull request 'G start: take-in.taken names its branch, source revision and entries; a taken event with no entries starts nothing' (#218) from fix/47-G-take-in-carries-entries into main 2026-11-15 16:58:03 +00:00
jschoubben 6a02d80072 graph: a node may leave out a package's seat call word it does not invoke itself (A-361)
The indexer leaves out a package's call word on a cycle (withCallsLeftOut, A-361), but the node check refused a left-out
word the module's own invokes do not name: once the node-engine's manifest stopped naming mesh-catalog.registrations
(mesh-host #229), the trunk revision the indexer wrote could not be read back, and the indexer stopped at its start.
2026-11-15 17:56:59 +01:00
jschoubben ba2a7d73b7 graph: a node may leave out a package's seat call word it does not invoke itself (A-361)
The indexer leaves out a package's call word on a cycle (withCallsLeftOut, A-361), but the node check refused a left-out
word the module's own invokes do not name: once the node-engine's manifest stopped naming mesh-catalog.registrations
(mesh-host #229), the trunk revision the indexer wrote could not be read back, and the indexer stopped at its start.
2026-11-15 17:56:58 +01:00
jschoubben f1231fccb0 indexer: take-in.taken names its branch, source revision and entries; runner: one with no entries starts nothing
The pipeline runner heard every take-in.taken with branch "" and source 0 and started no pipeline, asking the bus
for each again for ever: the indexer's event body never gained design 47 G §476, §493 and §648's fields. Every taken
event of one take-in now names the watched branch, the source revision it makes (one above the newest seen or said,
A-431) and one entry per module written; a taken event with no entries starts nothing and is journaled (§493).
2026-11-15 17:54:13 +01:00
jschoubben 310d4817ca indexer: take-in.taken names its branch, source revision and entries; runner: one with no entries starts nothing
The pipeline runner heard every take-in.taken with branch "" and source 0 and started no pipeline, asking the bus
for each again for ever: the indexer's event body never gained design 47 G §476, §493 and §648's fields. Every taken
event of one take-in now names the watched branch, the source revision it makes (one above the newest seen or said,
A-431) and one entry per module written; a taken event with no entries starts nothing and is journaled (§493).
2026-11-15 17:50:46 +01:00
jschoubben 5126d83722 assigner: a parts-reading node's want carries the parts beside the version, until G is delivered
Bootstrap circle on novox: the node-engine's grant to ask a registry's versions follows the node-engine build wanted
there, which needs a passed pipeline, which needs the pipeline runner that this want composes. With the parts beside
the version, the node-engine (8a0c392) composes by its parts and asks no registry. Recovery (lead-47).
2026-11-15 17:31:45 +01:00
jschoubben 40771c41ab grants: say each pass's errors and its sealed result in the journal (recovery, lead-47) 2026-11-15 17:25:07 +01:00
jschoubben 7507a250c7 grants: say each pass's decision on the user list; stop creating buckets for the pass once the bus refuses one
The user list in force on novox stayed at 14:53 UTC while the shadow list changed, and the pass said nothing of why;
each refused create of a state's object store waited out its bound, one after another. Recovery mode (lead-47).
2026-11-15 17:20:35 +01:00
jschoubben 260dab75d5 grants: every state's object store beside it is made and granted to its owner
A state of the field state had no <state>-objects store: the grants part made and granted object buckets from
the manifest's objects alone, so the indexer's state inputs (A-237) had no inputs-objects, and every validation
failed on a refused STREAM.INFO of OBJ_mesh-delivery-indexer_inputs-objects; the assigner's inputs likewise.
objectsOf now gives each such state its store (its size, 16 MiB when it names none; none for a state only read),
so the grants part creates it and grants it to its owner as the module's own bucket.

And a state asked in requires by the template state: the bus module's process may now make its store too (the
grants part's BusStateStreams names it, as mesh-sdk's does), and a kept binding's objects is among its streams.

Builds: design 47 G §58, §607, A-237
2026-11-15 17:13:54 +01:00
jschoubben f0e7631d11 assigner: test that a placed node's want held at F names its release
The rules' hold at F rebuilt the want without its version, so novox's want of mesh-delivery-pipeline stood as
{fp, self}; 98875eba names the release after the self derivation. This row fails without it.

Builds: design 47 G A-430a
2026-11-15 16:53:48 +01:00
jschoubben 98875eba70 assigner: a want names its build's version, never its artifacts' digests
A want of a released build names the module's version and no parts (A-430, A-430a): the node-engine resolves each
artifact at that version through its kind's registry seat. Every want that names a build gets it, whichever rule made
or kept it, a self want held at its fingerprint included: novox's want of mesh-delivery-pipeline stood as {fp, self}
since the rules held it at its fingerprint and that path never named the release. A candidate's added module carries
the version alone. A build the assigner knows no version of (another branch's, a kept one: build.ended names none) is
named by its parts as before, until the builder says the version it numbered it under. The release lookup says why it
misses when no assignment graph revision is kept.

Builds: design 47 G A-430, A-430a, §379, §526
2026-11-15 16:47:16 +01:00
jschoubben c62f8e07fd assigner: say why a want names no parts, and a want held for a dependency's delivery
The want of mesh-delivery-pipeline on novox stayed with no version and no parts after d1ed5fd5, and the assigner said
nothing. Each want the pass writes or keeps at a fingerprint with no parts is now said once per reason: whether the
node's engine reads parts (its record's capabilities) and whether a release or kept build of it is found. A want held
for its dependency's delivery (§376) is said when the hold starts.

Builds: design 47 G §379, §525, §376, A-420 (a path that says nothing)
2026-11-15 16:43:04 +01:00
jschoubben d1ed5fd555 assigner: read want-parts from a node record's capabilities
The want of mesh-delivery-pipeline on novox named no version and no part digests, so novox's node-engine of G composed
nothing: the assigner looked for want-parts among a node's manifest reads, while a node-engine of G states it among its
record's capabilities (design 47 G §525), so no node ever read as able to take parts. Both are read now.

Builds: design 47 G §525, §526, §379
2026-11-15 16:36:54 +01:00
jschoubben ba0d2eeacc assigner: ask the operator only for the change kinds the setting ask-operator-for names
Every proposal whose verdict passed waited on the operator's yes. Which are asked is now the assigner's setting
ask-operator-for, a list of change kinds (place, take-off, pin, unpin, hold, unhold, decide, config, add-node,
remove-node, and stops for a verdict whose answers say a node would stop a module), its default take-off, remove-node,
stops. A proposal none of whose changes is listed is applied at once, said in the log and by assignments-changed,
naming who proposed it and why. The key is declared in the manifest as the two others, filling a file the process reads
at each pass; a change of it is said.

Builds: design 47 G A-425, A-425a
2026-11-15 16:22:37 +01:00
jschoubben e0f12c8c37 assigner: rule 8 counts a healthy build that serves the verb whatever its phase says of the catalog
The pipeline runner's want on novox waited under rule 8 for seat:mesh-hand-acts.hand-act, which mesh-hand-acts serves on
novox from a healthy build the catalog holds no entry of: its have stands in phase held (entry-missing), and rule 8
counted only phase running. A node that runs a healthy build of a part serves what that build serves, whatever its
version and whether the catalog lists it: a healthy have held or waiting for a yes counts, unless its running statement
says it stopped or is not healthy, and the rule says which build it counted.

Builds: design 47 G A-426a, A-426, ADR 0614 §2
2026-11-15 16:19:01 +01:00
jschoubben d57fa43bcc assigner: a released build counts as done for rule 1
Rule 1 held mesh-delivery-pipeline's want as being built after a restart lost its build end, though 0.1.6 was released.
A build whose version is released counts as done for rule 1, and its build.ended counts only for a build not released.

Builds: design 47 G A-429, §379
2026-11-15 16:16:17 +01:00
jschoubben e0f0a56630 assigner: an acting wait ends when its part runs any build serving the edge's seat
The pipeline's want on novox waited for an assigner build not yet built, while a working assigner ran. An acting wait now
holds only while the acting part runs nothing serving the edge's seat on its node: a running build whose manifest claims
the seat (or one whose manifest cannot be read, the part holding the seat by its claim) ends it at once, whatever its
newest is, and the end says which build it took. A wait on a version not yet built is never held for that alone.

Builds: design 47 G A-426, §266, §268
2026-11-15 16:15:41 +01:00
jschoubben 0fe5f0aaaf assigner: read the builder's build ends whole from the first message at its start
Rule 1 held mesh-delivery-pipeline's want on novox as being built, though its build ended at 00:57:36: the assigner
reads the builder's stream of build ends whole at its start only when the bus keeps it last per subject, and the bus
keeps MESH_DELIVERY_BUILDER_BUILDS by age (168 hours, no max per subject), so after each restart it heard only the ends
said since. It now reads the stream from its first message whichever way it is kept (A-233), the last end of each
fingerprint standing. The integration test's stream is kept by age, as live.

Builds: design 47 G A-181, A-233, §556
2026-11-15 16:13:03 +01:00
jschoubben 9bb02a2cb2 assigner: want the pipeline runner's first build with no passed pipeline while no runner runs
The pipeline runner could never be wanted: a want follows a passed pipeline (§29), and nothing passes one before a runner
runs. While no module claiming the seat mesh-pipeline-runner runs on any node (read from the node-engine's running
statements), a module claiming it skips that gate and is wanted from the trunk's entry by the other rules, said once.
Every other module still waits for a passed pipeline.

Builds: design 47 G A-428, §29
2026-11-15 16:05:02 +01:00
jschoubben d4ed5ae13f assigner: say a want held for want of a passed pipeline, and what a refused put's node runs
The want of mesh-delivery-pipeline on novox was not written and the assigner said nothing: a module whose fingerprint no
pipeline passed at on its branch gets none (design 47 G §29), and that return was silent. It is now said as any rule's
reason, once per node. A put refused because the builder holds no build of its fingerprint now names the build the
node's running statement says it runs, so the put of A-427 can name it.

Builds: design 47 G §29, A-427, A-420 (a path that says nothing)
2026-11-15 16:03:29 +01:00
jschoubben 21523a449f assigner: a put may hold the build a node runs now
A put of ace's assigner at the build it runs (a hand start) was refused, since the builder's store holds no build of
it, so the trunk's newest build would replace it. Where the store holds none, a put naming the fingerprint the node's
running statement names is held there with the composition the node's have names; the store is not asked. A have
naming no composition at that fingerprint refuses it, saying so.

Builds: design 47 G A-427, A-426
2026-11-15 15:58:00 +01:00
jschoubben ad3d73d9bd assigner: say a want held by an acting part's version
The want of mesh-delivery-pipeline on novox was not written after the operator's yes, and the assigner said nothing:
its entry's acting edge place waits for the assigner's own catalog version to run on ace. Each acting wait the
assigner starts is now said, naming the entry, the part, the step, the version waited for and how it ends.

Builds: design 47 G §266, §268, A-420 (a path that says nothing)
2026-11-15 15:55:22 +01:00
jschoubben 9be15fe393 teller: ask every assigner ask at once; drop a lapsed or unknown key; the view never holds a raise back
The operator channel keeps no count of an asker's open asks (A-424), so the teller waits for no room: each of the
assigner's asks is asked when it is written, and the asks it could not hand the router are asked again at each end and
at its start. A key whose ask lapsed (its proposal ended) or that is of no kind the teller knows is dropped with a line,
never asked. The view's answer only fills an answer given there; one it cannot read is said and the ask is raised all
the same (it never held the raise back; its line said so wrongly).

Builds: design 47 G A-424
2026-11-15 15:54:32 +01:00
jschoubben 1f1126d4ec assigner: say a proposal's ask when it is written
The ask of proposal p-20261115t143855-09a7bc was written and the assigner's journal said nothing of it, so where it
stopped was found only in the teller's. The assigner now says each proposal it asks, with the ask's id and key.

Builds: design 47 G A-420 (a path that says nothing)
2026-11-15 15:46:36 +01:00
jschoubben af61faf706 teller: give the assigner's asks every place the router gives the teller
The ask of proposal p-20261115t143855-09a7bc never reached the operator: the teller kept it waiting for room, since two
old asks of the assigner (mailu's restore and hold, open since 2026-11-14) filled the two places it allowed, one being
kept free for the merge ask, which went with the Approve per merge (design 47 G §653). The assigner's are the only asks
the teller makes at the router now, so they take every place it gives (occ.MostOpen).

Builds: design 47 G §653
2026-11-15 15:46:24 +01:00
jschoubben 06ff2dc2c6 assigner: read an entry's fp-src, and key a release's parts by the reference it names
The candidate placing mesh-delivery-pipeline 0.1.6 on novox carried no parts, though its version-released was heard:
the assigner's module value of a catalog entry dropped the entry's inputs, so every trunk entry had fp-src 0 and A-419
never matched; and a release's parts were keyed <module>:<artifact> by prefixing the module to the artifact the event
names, which the contract gives whole (mesh-delivery-pipeline:program), so every release's parts read
mesh-delivery-pipeline:mesh-delivery-pipeline:program and A-421's match by digests missed too. The value now carries
the entry's src and fp-src, and a release's part is keyed by its reference as named.

Builds: design 47 G A-419, A-421, A-96
2026-11-15 04:02:09 +01:00
jschoubben b0242f68fe indexer: hear the kept seat events on their own streams
The two package-published of mesh-delivery-pipeline 0.1.6 sit on SEAT_mesh-builds_package-published, where the
indexer's program durable novox_mesh-delivery-indexer holds them pending and was never pulled: the program bound only
its durable on EVENTS, and a kept seat event is never there. So no version was released. The same holds for
toolchain-agreed (2 pending) and node-build-go's step-ended (10 pending). The program now binds, once its EVENTS
durable is bound, its durable on each kept stream whose event it handles, as the builder does.

Builds: design 47 G A-397, §349
2026-11-15 03:48:13 +01:00
jschoubben 240015c814 indexer: say every end of a package-published heard
A package-published of mesh-delivery-pipeline 0.1.6 left the catalog's versions empty and the indexer's journal
silent: the hearer said nothing when it heard one, waited for the module's other artifacts, took it as another
branch's, found the version released already or released it. Each of those ends is now said, naming the artifact,
the version, the branch and source, the artifacts still awaited and the fingerprint of the entry compared.

Builds: design 47 G §349, §371, A-420
2026-11-15 03:47:47 +01:00
jschoubben 61fff7da67 builder: say a message given up on the last delivery its consumer allows
The builder leaves an event it cannot take for the bus to give again, and the bus drops it after the fifth delivery its
durable allows without a word: the 0.1.6 published was lost so. On that last delivery the builder now says it gives the
message up, naming its subject, what it carries (a registry outcome's name and version, a version-released's module and
version) and the last refusal.

Builds: design 47 G A-420
2026-11-15 03:19:10 +01:00
jschoubben c677534e11 assigner: match a trunk entry with no fp-src to the release of what its build made
An entry whose fingerprint moved with no merge names no fp-src (ADR 0601 §1), so A-419 found no release for it and its
wants and candidates carried no parts. Such an entry now takes the release whose parts' digests are the digests its
fingerprint's build.ended made; one found by neither way is said, naming which was tried.

Builds: design 47 G A-421, A-419
2026-11-15 03:18:31 +01:00
jschoubben 8e3b44c6fc indexer: say a message given up on the last delivery its consumer allows
The indexer leaves an event it cannot take for the bus to give again, and the bus drops it after the fifth delivery
its durable allows without either saying so: a package-published lost so leaves a version unreleased silently. On
that last delivery the indexer now says it gives the message up, naming its subject, what it carries (for a
package-published the artifact and version) and the last refusal.

Builds: design 47 G A-420
2026-11-15 03:17:11 +01:00
jschoubben ce839ba602 assigner: match a trunk build's release by the source its fingerprint was built at
namedBuild matched a trunk entry's version-released by the kept assignment graph's source revision, so after any merge
that does not rebuild a module its wants and candidates carry no version and no parts. It now matches by the entry's
fp-src, the source revision its fingerprint was built at, which is version-released.source for that build; an entry
whose release is not heard, or that names no fp-src, is said once, naming the module, the fingerprint and the source.

Builds: design 47 G A-419, A-96, A-67
2026-11-15 03:15:58 +01:00
jschoubben 2beb39c371 builder: take a registry outcome the old numbering does not hold through to the reservation
oci-artifact-registry's published of mesh-delivery-pipeline/program@0.1.6 was refused as 'not numbered by the builder'
and left for the bus, up to its consumer's five deliveries, and no package-published was said: the version is the
reservation's (§369), never an entry of the state versions, design 51's numbering by name, which G keeps only until
it is removed (§372). Such an outcome is now taken: the reservations mark it and say package-published (A-415). The
log of an outcome left for the bus names its delivery count.

Builds: design 47 G §369, §372, §52, A-415
2026-11-15 03:13:22 +01:00
jschoubben e84e2adff0 builder: answer reserved for a bundle's or an archive's name, and log a name no entry carries
distribution's tag of mesh-delivery-pipeline 0.1.6 was refused: reserved answered 'no entry carries the name
mesh-delivery-pipeline/program', since the lookup matched only an artifact's package name and a bundle's entry
names none. A bundle's or an archive's name is <module>/<artifact>, read from its reference through NameOf; a
name no entry carries is said in the builder's log with the entries looked at.

Builds: design 47 G A-418, §478, §572
2026-11-15 03:00:14 +01:00
jschoubben 2394dec1c5 builder: name a publish again's transfer as a valid transfer id
The registry refused builder_publish_again of mesh-delivery-pipeline 0.1.6 with 'transfer ... is no transfer id':
the name carried the version's dots, which mesh-sdk's parts receiver refuses. The transfer stays the builder's own
name (the registry part's publish), with the refused characters made dashes.

Builds: design 47 G §588, A-73
2026-11-15 02:36:13 +01:00
jschoubben e75112baec builder: know a registry seat's holder from the seat-holders view from the start, not from running heard
builder_publish_again for mesh-delivery-pipeline 0.1.6 queued nothing after a restart: the holder was learnt only
from node-engine running events heard since the builder started. The Republisher now reads each registry seat's
holder from the catalog's SeatHolders, the holder function the builder's FollowSeat of the assignments takes;
publish again and a node's returned queue at it. A running still queues the versions waiting on its module.
A seat with no holder is logged by name.

Builds: design 47 G §588, A-416, A-416a
2026-11-15 02:18:38 +01:00
jschoubben f89f34ce7b builder: keep a published heard before the build's digests and say package-published when they are recorded
A trunk build's registry publishes during the build, before the builder records the digests on the reservation;
such a published was acknowledged and lost, so package-published was never said. It is now kept on the reservation
(name, version, digest) and marks its artifact when the digests are recorded; one that never matches is logged.

Builds: design 47 G §588, §52, §334, A-73, A-415
2026-11-15 02:07:47 +01:00
jschoubben 1506507f21 builder, assigner: say why a package-published is not said and why an added module carries no parts
Builds: design 47 G §588, §52, §334, A-73, A-316
2026-11-15 02:04:23 +01:00
jschoubben 8a340b5297 steprun: retry the seat list reader's start with backoff and say why asks are given back
Builds: design 47 G §543, A-163, §543 (lead-47 2026-11-15: the reader's start is retried)
2026-11-15 01:15:29 +01:00
jschoubben e0632b2c0e mesh-grants: the part makes the build seats' named workers its composed holders name (A-413)
Builds: design 47 G A-413, A-414
2026-11-15 01:03:52 +01:00
jschoubben 69c24b5270 mesh-grants: named asks stay in use while a wanted build invokes a queue; the named-asks decision is said (A-413, A-414)
Builds: design 47 G A-413, A-414
2026-11-15 00:49:09 +01:00
jschoubben 9496c57d41 mesh-grants: say how a want's newest build was read and which left-out modules' seat workers are not created (A-413, A-414)
Builds: design 47 G A-413, A-414
2026-11-15 00:32:20 +01:00
jschoubben 84e640b7d2 mesh-grants: a running build with no catalog entry is composed from the entry of its want's newest build (A-414)
Builds: design 47 G A-414 (A-407, A-413)
2026-11-15 00:24:41 +01:00
jschoubben c636642864 mesh-grants: named asks stay in use while a held membership publishes one (A-413)
Builds: design 47 G §544, A-413, A-231
2026-11-15 00:11:16 +01:00
jschoubben 9eb143ab6c mesh-grants: named asks stay in use while an account is granted to publish one (A-413)
Builds: design 47 G §544, A-413, A-231
2026-11-15 00:04:42 +01:00
jschoubben 598125a1d5 Builder: an entry's manifest digest is taken bare through the catalog contract's reading; a look that writes nothing says why
Builds: design 47 G A-412, A-412a
2026-11-14 23:46:01 +01:00
jschoubben 218d5cb67f Builder: read the last versions-filled at start from its kept stream, not EVENTS
The seat event's own stream is heard from its first message through the SDK's HearSeatEvents with FromFirst; nothing of EVENTS is read and no new grant is needed.

Builds: design 47 G A-411 (replaces A-408's read of EVENTS)
2026-11-14 23:39:06 +01:00
jschoubben c625733a33 Indexer: catalog-revision's duplicate id names the branch and it is published through the bus's acknowledgement
Builds: design 47 G A-409
2026-11-14 22:55:59 +01:00
jschoubben da82c2cf80 Grants: a consumed seat event matches the seat's event of that name whatever parts its subject has; a consume of a seat that says no such event is refused aloud, never a module's event
Builds: design 47 G A-409
2026-11-14 22:55:59 +01:00
jschoubben 0071181fb1 Builder: read the last versions-filled at start
The builder kept the catalog's versions-filled in memory only and its durable
consumer took the event once, so a restart left every build wait-held. It now
reads the last message of the subject from the events stream at its start (a
read that fails is retried with backoff in the background).

Builds: design 47 G A-408, §369, §372
2026-11-14 22:49:04 +01:00
jschoubben 1b3cc20127 Indexer: a head the source names with no merged message, or none it can read, is read whole through the seat git and taken in as a merge of every file of its tree, with its templates' needs and the predefined list (A-401, A-402)
Builds: design 47 G A-401, A-402, A-93, A-85
2026-11-14 22:17:44 +01:00
jschoubben 5b0925ce3a Indexer: take a registered module in at the head of its first watched branch when no build record names it: f1-circuits (master), link2pay and photos (nox-mesh) could not be held, so the assigner refused every proposal (design 47 G A-85) 2026-11-14 21:45:27 +01:00
jschoubben c9f70c9287 Assigner: read a whole state in pages, not a key at a time: the assignments took 27 s to read and a proposal outlasted its caller's 30 s, the same kind as the indexer's view of the trunk 2026-11-14 21:42:05 +01:00
jschoubben 7ce4720854 Assigner: say each step of a proposal with its time, and a node record slow or failing to read: a proposal that passed timed out at 30 s with no word of where 2026-11-14 21:36:46 +01:00
jschoubben 9a3a6bd3ba Forge bridge: say each member of a delivery group once: the seat named novox/mesh-sdk#189 twice in feat/47-G-join11, and every repository with a branch of that name was refused its take-in whole 2026-11-14 21:22:07 +01:00
jschoubben 3cdd4943f0 Indexer tools: keep the view of the trunk while its revision stays the newest, and page it: every key re-read the whole revision, so propose timed out on a first view of about 11 s a page
The assigner says each indexer view it reads, how many pages and how long, and a page that does not answer.
2026-11-14 20:59:31 +01:00
jschoubben 4ee5b45cb8 Grants: say each consumer it creates, and once each it cannot create: which bookmarks exist was readable only on the bus 2026-11-14 20:24:10 +01:00
jschoubben ddee3bf9af Assigner: a seat no assignments holds is written in seat-holders as held by the assigned module whose manifest claims it, and said (A-400): the indexer waited for a holder of mesh-module-assigner for ever 2026-11-14 20:21:17 +01:00
jschoubben 4a83418c02 Builder: says each toolchain it hears, and whether it changed what it knew 2026-11-14 19:00:01 +01:00
jschoubben 5f7f6b3e40 Grants make the tool runner's twin of each module durable with its rights; the builder binds its kept seat events (A-397) 2026-11-14 18:58:20 +01:00
jschoubben 5b4c454ca2 Grants: the holder of a seat pulled by kind says the seat's own events, on its machine where the subject names <node> (A-399): a build seat's step-ended and toolchain-reported were granted to nobody 2026-11-14 18:39:45 +01:00
jschoubben b0756f8b45 Grants: a seat-form read, view or view tool resolves to the assigned claimant when no holder is on record (A-398): the builder's reads of the build seats' steps stayed unresolved and refused 2026-11-14 18:17:20 +01:00
jschoubben 1695075836 Indexer: a seed's registration write ends no proposal key (an empty key stopped the seed after its first module); the history fill is read within a second and its failure said 2026-11-14 17:13:11 +01:00
jschoubben 306534fdf0 Indexer: a registration's write logs each step with its time; a first registration prunes nothing; a seed stopped part way writes what it has not 2026-11-14 17:01:52 +01:00
jschoubben 0933144535 Indexer: a take-in ask logs its start and end, and the seed logs each step, so a request that hangs says where 2026-11-14 16:55:48 +01:00
jschoubben 86fb18afb7 Indexer: a seed asked again writes the registrations its key composed, with no build seat asked again 2026-11-14 16:55:09 +01:00
jschoubben a6ab2e54cd Indexer: the first registrations are written from the module graph it holds, with no ask (the operator, 2026-11-14: a module in the module graph is a registration) 2026-11-14 16:44:13 +01:00
jschoubben 5255ffa0c4 Grants: a seat-named view also grants asking its holder's first-view tool, so a reader's first view is not refused by the bus (design 47 G §616; live start: the indexer's seat-holders view) 2026-11-14 16:26:59 +01:00
jschoubben b0d263c336 Indexer: a registration's ask names the module and its repository, not the manifest path (A-402)
Live on novox 2026-11-14 15:20 the operator channel refused the seed's ask: its lines named paths (modules/<m>/module.json),
which the messenger's check refuses as a file path or a random-looking run. Checked against the messenger's Check: the
seed's whole words pass.
2026-11-14 15:23:35 +01:00
jschoubben ba50db813a Test: the holder's own tools read its catalog revision (A-401) 2026-11-14 15:03:30 +01:00
jschoubben 3303e9170c Indexer: the seed's ask says a short digest, and the holder's own tools read its catalog revision (A-400, A-401)
Live on novox 2026-11-14 15:01 the operator channel refused the seed's ask for a 64-hex digest in its words, as a secret;
the Approve binds the whole digest through the option. The tool runner reads the catalog half for the indexer's own tools
on its account and was refused every minute.
2026-11-14 15:03:12 +01:00
jschoubben 6a91fa15f6 Indexer seed: the module directory goes with named paths only (ADR 0499 clause 4)
Live on novox the Go and Node build seats refused every seed steps call with 'the request names a module directory and no path': the trunk entries name no paths, and the seed sent the directory alone.

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 12:17:27 +01:00
jschoubben 7e4c9b9992 Grants: every module is composed as invoking the tool runner's own reads (A-396)
Live on shanks the build runtimes' seat list and catalog-half reads were refused on their caller-named subjects, since the modules' manifests do not invoke them, and the no-caller fallback is answered by nobody.

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 12:09:51 +01:00
jschoubben 34e1938df1 Indexer: every trunk part and the tool runner may read the catalog half (A-395)
Live on novox the tool runner's first view of catalog-revisions was refused 54 times: the revision verb answered only the parts declaring it in invokes, and the runner reads it for every module it serves.

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 12:00:53 +01:00
jschoubben 990f6c6598 mesh-grants: a node seat's verb is also granted without the machine
Holders subscribe and callers publish on mesh.seat.<seat>.tool.<verb> (and its call form) beside the machine-named subject, so a verb asked of no machine is answered by any one holder in a queue group.

Builds: lead answer A-393 (design 47 G)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 11:32:20 +01:00
jschoubben e5bb4fa9bc indexer seed: an unanswering build seat is called once per seed
Later artifacts of a seat that did not answer stay unanswered without a call; one log line says so when the seat first goes unanswered. Per lead answer A-392.

Builds: design 47 G §704, lead answer A-392

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 11:25:20 +01:00
jschoubben acb12fea95 Test: the bus module's keeper consumer filters a watched mesh-seat event on its parts
Covers busstate.go keeperConsumer for the seat definition subject catalog-revision.<branch>: restoring the old body fails the table test.

Builds: design 47 G (seat definition subjects with parts)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 04:37:15 +01:00
jschoubben c37426f64b Grants: a watched seat event takes its definition's subject parts as * for any scope
mesh-catalog's seat.json gives catalog-revision the subject catalog-revision.<branch> (likewise source-moved.<branch>,
group-ended.<branch>.<group>, owed.<repository>.<number>). watchedEvents widened only a node seat the node-engine holds
(machineEvent), so the consumer and subscribe grant of a module consuming mesh-catalog.catalog-revision (node-tools,
builder, teller, pipeline) stayed on the bare subject and never took the branch-form event. One rule now
(watchedEventSubject, used by the grants and the bus module's consumer): each part is *. A held consumer gains the
filter through AddFilters (grants/consumers.go).

Builds: design 47 G (seat definition subjects with parts)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 04:33:47 +01:00
jschoubben 6edb9ab526 Indexer: say catalog-revision on its branch's subject, the one the bus allows
The bus refused the bare subject mesh.seat.mesh-catalog.event.catalog-revision: the seat definition
(mesh-delivery-contracts/seats/mesh-catalog/seat.json) gives the event the subject catalog-revision.<branch>, and the
holder is granted catalog-revision.*. The publish now uses meshcatalog.SubjectCatalogRevision(the event's branch); an event
with no branch is refused loudly, never given a bare subject.

Builds: design 47 G, the seat definition mesh-catalog (event catalog-revision, subject catalog-revision.<branch>)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 04:21:50 +01:00
jschoubben dc4f1dff39 Indexer: the start replay keeps the view once, and only when a build end wrote
lead answer A-391: the start replay keeps the view once (measured: 50 min CPU per start).
applyBuildEnd reports whether it wrote; ApplyBuildEnd keeps the view only then;
ApplyBuildEndsAtStart applies every entry and keeps the view once if any wrote.

Builds: design 47 G lead answer A-391

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 04:04:45 +01:00
jschoubben 6c47ffcf8f Indexer: a single * in invokes declares the verb revision (A-390)
The verb revision's callers rule matched seat:mesh-catalog.revision by exact text only; the grants part reads a single * as every seat verb, so node-tools was refused. Match that reading; the holder stays off the list.

Builds: design 47 G, lead answer A-390

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 03:20:47 +01:00
jschoubben 0259d77d11 mesh-catalog seat: class modules, module, provides, dependents and seat-definitions as reads
Before its catalog half is read, a tool runner's gate lets through the
verbs its held definition classes read; these five read only and are
now classed so.

Builds: design 47 G lead answers A-387

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 02:23:38 +01:00
jschoubben 1ed86db4aa mesh-delivery-forge-bridge: read the open groups, and one group by its id, never every ended group in one answer
The merged message and the catch-up asked the seat's groups with all=true, whose answer outgrew one bus message
(2888983 bytes, live 02:06), so no take-in answered. Read asks the open groups, MergedOf the one group its branch
names (group=<id>); the list a person asks (bridge_groups) keeps ReadAll.

Builds: lead: principle 7, live 02:06

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 02:12:17 +01:00
jschoubben 21b53f5dfb mesh-grants: read the loaded list one user per answer, so no answer exceeds one bus message
lead: principle 7, live hold 02:0x (nats_users for the whole list was 1086642 bytes, over 1048576).
Builds: design 47 G, lead's handover (no design line beyond principle 7)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 02:01:49 +01:00
jschoubben fa5df62e97 A-386 runner-left-out-is-kept-and-carried: a tool runner of the list in force that the pass composes no account for is kept as it runs and written as a carrying runner
Builds: design 47 G A-386 (G-22-lead-answers-2.md)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 01:53:44 +01:00
jschoubben 54a19f3f64 A-373 tools-read: a reader that cannot open a list or pass object is shown its small fields and where the rest is, so what the last pass said of the sealed list is readable
Builds: design 47 G A-373 (G-22-lead-answers-2.md), the tools' read of the keys list and pass

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 01:51:19 +01:00
jschoubben 6edfe1da8d A-386 kept-runner-carries-a-module-known-by-its-bindings: a module placed on a node whose manifest is unreadable is carried by a kept runner by its kept bindings alone
Builds: design 47 G A-386 (G-22-lead-answers-2.md), live read of the gate's membership

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 01:42:00 +01:00
jschoubben 89e36241cb A-386 kept-runner-gains-its-carried-modules-grants: a runner kept as it runs is the union of the list in force and a carrying runner's grants from the modules placed on its node
Builds: design 47 G A-386 (G-22-lead-answers-2.md)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 01:33:48 +01:00
jschoubben 14901e8723 A-385 runner-reads-a-carried-modules-bound-ledger: the tool runner carrying a module with a bound ledger reads its state, indexes, history and snapshots, and writes its state
Builds: design 47 G A-385 (G-22-lead-answers-2.md), their bindings

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 01:26:46 +01:00
jschoubben 66ae3cd918 A-385 kept-accounts-are-a-union: an account kept beyond a pass is the union of the list in force and what the pass composes for it, a held runner composed from its running build's manifest
Builds: design 47 G A-385 (G-22-lead-answers-2.md)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 01:09:07 +01:00
jschoubben c3fd353abe A-384 runner-hears-new-events: every tool runner account carries the ordered consumer of EVENTS and each kept seat stream, kept or held ones included
Builds: design 47 G A-384 (G-22-lead-answers-2.md)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 00:44:32 +01:00
jschoubben 968e1b7493 A-383 kept-accounts-gain-the-right-every-account-carries: a kept or held account of the list in force gains the streams' names, as every composed one does
Builds: design 47 G A-383 (G-22-lead-answers-2.md)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 00:23:49 +01:00
jschoubben 0ad09c7382 A-382 every-account-lists-stream-names: the composer gives every module, process, node and runner account the streams' names, in place of grants' own row
Builds: design 47 G A-382 (G-22-lead-answers-2.md), replaces A-381's special case

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-14 00:07:55 +01:00
jschoubben 8604d121eb A-381 grants-account-lists-stream-names: grants' account may ask the names of the bus's streams, which creating a kept event's stream asks first
Builds: design 47 G A-381 (G-22-lead-answers-2.md)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 23:59:38 +01:00
jschoubben d6d6bd1891 A-373 round 2: grants' account reads back its own objects; withheld is answered from a small key beside the list
Builds: design 47 G A-373 (G-22-lead-answers-2.md)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 22:09:21 +01:00
jschoubben e2eb99fc19 A-373 grants-list-and-pass-as-objects: the keys list and pass of user-list name an object of the part's bucket, since each outgrows one bucket value
Builds: design 47 G A-373 (G-22-lead-answers-2.md)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 22:04:21 +01:00
jschoubben fc51bf4832 Round 2: grants says the absent stream in its status and pass result; tests that fail without A-372's settle call and without Ready's reading of the first views
mesh/delivery ready: it is merged on the Approve
mesh/delivery-group group fix/47-G-start-2 checking: 2 of 2 member(s) ready
Builds: design 47 G A-371 health clause, A-372, A-368 (G-22-lead-answers-2.md)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 21:03:59 +01:00
jschoubben 3c929d518c A-365: a test through ApplySource sees the fingerprint computed again when a package's repository head moves
Builds: design 47 G A-365

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 21:03:09 +01:00
jschoubben e383004afc A-372 assigner-settles-on-a-mesh-naming-no-branch: the assigner's first pass is told once when the catalog client says the registrations and the source name no branch
Builds: design 47 G A-372 (G-22-lead-answers-2.md, hq design/47-G-lead-answers-31)
Also: Ready reads what the first views hold, since a first view closes before the follower's change is taken into the branches followed; Branches.FirstViews says when both are in.

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 20:57:52 +01:00
jschoubben 27072735e9 gofmt 2026-11-13 20:57:34 +01:00
jschoubben 30f8e7407b A-370: the verb registrations is answered from its state at once, not queued behind a take-in
Builds: design 47 G A-370

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 20:57:29 +01:00
jschoubben 6458b72062 A-371 grants-empty-first-view-of-its-own-stream: a kept stream grants creates and the bus lacks is an empty first view, no wait
Builds: design 47 G A-371 (G-22-lead-answers-2.md, hq design/47-G-lead-answers-31)
Note: the earlier commit 7f3aeedf (A-369, grants' Waiting asks Ready) is titled S6 by mistake.

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 20:56:33 +01:00
jschoubben 49fbb17db9 Review r1: candidates and the trunk take the source's head for an unpublished package; the own build is read inside ownBuildVia
Builds: design 47 G A-365, A-366

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 20:56:19 +01:00
jschoubben ff8b27c89b Merge branch 'fix/47-G-start-2-index' into fix/47-G-start-2 2026-11-13 20:45:59 +01:00
jschoubben 7f3aeedfc0 S6 grants-wait-asks-ready: grants' wait for its catalog half asks the catalog client's Ready, so a mesh naming no branch is none-yet
Builds: design 47 G A-369 (G-22-lead-answers-2.md)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 20:45:47 +01:00
jschoubben eaa903a8ec S4 catalog-ready-on-a-fresh-mesh: with the registrations and the gate's source answered and naming no branch, Ready is nil and the view is empty
Builds: design 47 G A-368 (G-22-lead-answers-2.md), start-waits.md S4

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 20:43:21 +01:00
jschoubben 72aba8c415 S2 grants-account-creates-kept-streams: a test holds that the grants account carries the create of each kept event stream of the seat list
Builds: design 47 G A-364 (G-22-lead-answers-2.md), start-waits.md S2

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 20:42:36 +01:00
jschoubben a118867b43 S1 grants-unread-catalog-no-hold: an entry not answered while the catalog half is unread is no failed read, so the list composes from the trunk and the want's entry
Builds: design 47 G A-363 (G-22-lead-answers-2.md), start-waits.md S1

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 20:41:44 +01:00
jschoubben 69b6fa7393 S5b: a mesh Go package no module publishes is built at the source's commit of its repository
Builds: design 47 G A-365

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 20:39:59 +01:00
jschoubben b2bddecde2 S3: the indexer takes its own build from MESH_FINGERPRINT first
Builds: design 47 G A-366

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 20:37:25 +01:00
jschoubben bac26c8a28 Merge pull request 'G start: the indexer serves modules again, the watchman builds, the graph's order comes from the verbs a package calls' (#216) from fix/47-G-start into main
Reviewed-on: #216
2026-11-13 19:08:09 +00:00
jschoubben 536c573223 A-361: a package's seat call words obey the cycle rule
mesh/delivery merged: source.main moved to novox/mesh-delivery@bac26c8a288b
mesh/delivery-group group fix/47-G-start merged: every member is merged
The graph left out only invoked verbs on a cycle, so a package's seat call word's kind-6 edge stayed on a cycle (the
gate and the indexer, the gate and mesh-hand-acts at every SDK release). The module graph's LeaveOut now runs over the
entries with each package's seat call words counted among the invokes of every module built against it, and what it
leaves out joins each entry's LeftOut.

Builds: design 47 G A-361, A-357; ADR 0614 §3
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 17:45:43 +01:00
jschoubben ec58535ca0 A-360: the indexer says each new trunk revision's change of modules on views.modules
The grants part follows the first view modules on the indexer's views family after its first ask. G's indexer keeps
no state modules, so nothing said its changes and a newly merged module reached grants only when it asked again. A
new trunk revision that changes the modules is now said as the mark of modules at that revision's number (the number
the first view answers every value at), after which a reader short of it asks the first view once; views.modules is
among the indexer's emits.

Builds: design 47 G A-360, A-354
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 17:33:57 +01:00
jschoubben 359c37d17f A-357: a package's seat-verb call word orders its users after the verb's server
A package's `calls` names the seat verbs its code calls on a module's behalf in the invokes form; the indexer derives
an edge of kind 6 from such a word against the verb's server, as from `invokes`, so every module built against the
SDK is delivered after the running versions that serve its start. The path for stated capability words stays.

Builds: design 47 G A-357, §47 (kind 6)
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 17:31:54 +01:00
jschoubben a015b5ed24 A-354: the indexer serves the first view modules again, for the grants part
The grants part reads mesh-delivery-indexer.modules as one of its five first views; G's indexer stopped serving it
(deb88b17), so the read is a failed gap and grants issues no new right once G's indexer runs. The tool comes back in
its form before G (the first-view tool over the state modules, its callers list), answered from the newest trunk
revision, until grants reads the catalog half.

Builds: design 47 G A-354
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 17:30:39 +01:00
jschoubben 4c112de4d5 A-355: the watchman requires and replaces the build seats it imports
cmd/mesh-delivery-watchman imports the seats nodebuildimage and nodebuildnode, but its go.mod named only
nodebuildgo, so the watchman did not build from main. Every G part builds from main before any is placed.

Builds: design 47 G A-355
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 17:28:04 +01:00
mesh-tools 21eaa55b27 Merge pull request 'Bridge for G's take-in: the pre-G package directories again, unused' (#215) from fix/47-G-bridge into main 2026-11-13 13:40:32 +00:00
jschoubben 541eaa20fe Bridge for G's take-in: the pre-G package directories contracts/go and sdk again, unused
mesh/delivery merged: source.main moved to novox/mesh-delivery@21eaa55b277a
mesh/delivery-group group fix/47-G-bridge merged: every member is merged
mesh/check checking 541eaa20fec4 on 21eaa55b277a
The running pre-G indexer publishes a repository's packages only when every package directory it published last is
still in the tree; G moved contracts/go and sdk to modules/, so mesh-delivery's packages, G's renamed paths among them,
are never published and nothing importing them builds (2026-11-13, indexer journal 'its packages are not published').
These are the trees of e70754ef, unchanged, without sdk/module.json (no second module). Nothing imports them; they go
once G's indexer runs and publishes without them.

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 14:34:40 +01:00
mesh-tools 93e222a8a8 Merge pull request 'Milestone 47 G: mesh-delivery's part of the one release' (#214) from feat/47-G-join12 into main 2026-11-13 13:08:58 +00:00
jschoubben bc8126efef Count a bus module's running build as offering bus-state while its newer build waits for a yes (ADR 0614 §5, A-352)
mesh/delivery merged: source.main moved to novox/mesh-delivery@93e222a8a8b6
mesh/delivery-group group feat/47-G-join12 merged: every member is merged
mesh/check checking bc8126efefa9 on 93e222a8a8b6 | novox/mesh-delivery#214 in group feat/47-G-join12
A have in phase waiting-yes keeps the build that still runs and that build's health (the node-engine writes the
running fingerprint and composition, and its check's health), and that build serves the bus state. So the
bus-state rule no longer holds a consumer that needs none of the newer build's forms: live, zfs on ace waited
while nats on novox waited for a yes with its old build running. A consumer of a form only the newer build reads
still waits by its kind-4 edge (§50), unchanged.

Builds: ADR 0614 §5 and §2, A-352

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 13:11:28 +01:00
jschoubben 8d40d90950 Fill the catalog's versions from every number the builder gave, numbered or published (design 47 G §372, A-350)
The builder numbers fresh versions without publishing them, so a fill from published alone would number again
below what the builder already said, and one version would name two contents. The fill and its kind 1 and 3 edges
take numbered and published alike; the version-form check and the claimed cut stay. A version the builder numbered
without a digest is filled with none.

Builds: design 47 G §372, A-350, A-351

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 13:06:53 +01:00
jschoubben ff9f089dd8 Merge main into feat/47-G-join11: reader release 3 (D1-D6); G's validator holds
The release copied G's judge rules (D1 queue invokes, D2 seat reads, D3 objects cap, D5 process bus consumes) and
added a transition, foundationAtG, for the parts G puts on the foundation list. Every conflict (busstate.go,
judge_test.go, rules.go, rules_test.go) and the two files merged cleanly (oldsections.go, busstate_test.go) are
resolved to G's form: G's foundation list holds and foundationAtG goes; G's g_words_test rows judge the objects cap.
The tree is G's head 8899b62c.

Builds: design 47 G (the milestone's mesh-delivery part, as at 8899b62c)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 12:50:29 +01:00
mesh-tools e70754ef56 Merge pull request 'Reader release 3 before G: today's manifest validator accepts G's forms' (#212) from feat/47-G-reader-release-3 into main 2026-11-13 11:04:19 +00:00
jschoubben 4b29e43ca1 D6 judge-release-whole: the release's judge accepts all of G and keeps today's verdicts
mesh/delivery merged: source.main moved to novox/mesh-delivery@e70754ef562b
mesh/delivery-group group feat/47-G-reader-release-3 merged: every member is merged
mesh/check checking 4b29e43ca1f4 on e70754ef562b | novox/mesh-delivery#212 in group feat/47-G-reader-release-3
A run, no code: the prepare's probe (reader-release runs/rrprobe.go.txt) built in the indexer module at this head
against mesh-sdk 9e5bd7e. G's 193 manifests with G's 65 seat definitions: 193 accepted the checker's way, 0 refused and
0 waiting the indexer's way (today: 15 refused). Today's 191 manifests with today's 60 seats: 189 accepted, f1-circuits
and link2pay refused, output identical to today's; today's manifests with G's seats: identical to today's.

Builds: design 47 G §50, §340, A-343, A-347

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 11:47:46 +01:00
jschoubben 1a16fb55da D4 judge-foundation-list: the pipeline runner keeps its old sections before G too
The lead's A-349 names the pipeline runner beside the forge module, the image registry module and the node-engine's
module: its old `objects` section and its findings stream are accepted before G puts it on the foundation list. It is
new in G, so no trunk verdict moves.

Builds: design 47 G §529, A-345, A-349

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 11:47:21 +01:00
jschoubben b30232298c D4 judge-foundation-list: the parts G puts on the foundation list keep their old sections before it
Before G's merge the foundation list stays as it is; the forge module, the image registry module and the node-engine's
module are accepted with their old `objects` section, their stream `<module>-findings` and their bus state in
`requires`, as G's judge accepts them, and are counted as today, so no other module's verdict moves.

Builds: design 47 G §584, §627, §529, A-343, A-345

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 11:45:26 +01:00
jschoubben 771471c83b D3 judge-objects-cap: a state may name objects-max-mib for its objects store
The state template takes the option `objects-max-mib` (mesh-sdk S5's name and bounds): within the objects' bounds it is
accepted, outside them refused; every other option of today keeps its verdict.

Builds: design 47 G §513, §547, A-343

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 11:44:20 +01:00
jschoubben cee3102568 D2 judge-seat-reads: a read of a seat holder's state is judged against the seat's states
`reads` `seat:<seat>.<state>` (split by mesh-sdk's SeatRead since S4) is accepted where the seat declares the state and
refused, naming it, where it does not or the seat is unknown; a module's read is judged as today.

Builds: design 47 G A-116, A-128, A-343, A-344

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 11:43:47 +01:00
jschoubben 3543e7818b D5 judge-process-bus-consumes: a process hears only what its module consumes
A process's `bus.consumes` (read by mesh-sdk since S2) is judged as V5 judges what a process names of its module's
`requires`: an event its module consumes is accepted, another is refused, naming it.

Builds: design 47 G A-340, A-343

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 11:42:54 +01:00
jschoubben 4ce2d82645 D1 judge-queue-invokes: an asker's queue and a seat's accepted kind are judged against the seat
The third reader release reads G's invokes `seat:<seat>.accept.<queue>` and `seat:<seat>.<stream>.<kind>` with G's
check of them: a queue or kind the seat's definition does not accept is refused, naming it.

Builds: design 47 G §601, A-231, A-102, A-343, A-344

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 11:42:08 +01:00
jschoubben 8899b62cd4 A-342 judge-node-env: a resource's own MESH_NODE is refused
mesh/delivery-group group feat/47-G-join11 checking: composed again for its members' new heads
mesh/delivery closed: the pull request closed unmerged
mesh/check checking 8899b62cd430 on 7c0492b06c37 | novox/mesh-delivery#209 in group feat/47-G-join11
The node-engine sets MESH_NODE to its node's name in every process it runs; the judge refuses a resource whose env sets it, so the mesh's value is the only one.

Builds: design 47 G A-342

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 09:20:46 +01:00
jschoubben 7044bf5024 A-340 process-bus-consumes: a process hears only what its module consumes, and is granted exactly that
The judge refuses a process's bus consumes its module does not consume (beside V5). The grants part gives such a process the subjects of those events, its own durable <node>_<module>_<process> on EVENTS and on each kept seat event's stream, and their consumer grants, and makes those consumers, as G1 gives the publish.

Builds: design 47 G A-340, A-339; design 42 zfs-owns-zfs V5, G1

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 09:16:25 +01:00
jschoubben 48c7d8252e Merge main into feat/47-G-join11: the zfs group's validator rules and process-bus grants (issue 1979)
The grants of a process's bus on requires (G1) join G's process principal: BusStreams beside G's Serves (AnswersSeat) and MarkedVerbs, and the emits of a requires stream split from the old emits as main does. The rules V1-V5 merged into G's judge whole.

Builds: design 47 G §383 (form kept); design 42 zfs-owns-zfs V1-V5, G1, A-38

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 09:10:44 +01:00
mesh-tools 7c0492b06c Merge pull request 'The validator judges if-config, config-lines, config-json and a process's bus on requires; grants follow (issue 1979)' (#211) from feature/1979-zfs-owns-zfs into main 2026-11-13 08:00:36 +00:00
jschoubben 9e98b28844 Validator (A-337): the trunk case counts and declares by every manifest that decodes
mesh/delivery-group group feat/47-G-join11 checking: 15 of 17 member(s) ready
mesh/delivery closed: a newer head of the same pull request
mesh/check checking 9e98b2884440 on 7c0492b06c37 | novox/mesh-delivery#209 in group feat/47-G-join11
A change of migrated manifests was refused against an unmigrated trunk: the
old sections were counted and the seats declared only by the trunk manifests
the new rules accept, so every count was 0 and every declarer gone. The
trunk case now counts and declares by each manifest that decodes, and one
that does not decode is named in the trunk case's verdict.

Builds: design 47 G §712, A-337

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 02:53:57 +01:00
jschoubben bf852f27aa Runner (A-336): a publish heard before its branch's half starts with no steps
A-336 holds for every start of a pipeline: a package-published heard before
its branch's catalog half was held still placed steps from empty entries. Its
pipelines now start with no steps, placed by A-327's path once the half is
held. The hand start already refuses a branch whose half is not held.

Builds: design 47 G §200, A-327, A-336

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 02:43:18 +01:00
jschoubben d827d1abf0 Runner (A-336): a take-in heard before its branch's half starts with no steps
A take-in heard before its branch's catalog half was held placed steps from
empty entries, acting on a branch §200 says nothing new of is acted on. Its
pipelines now start with no steps, and the half becoming held places them by
A-327's path, also when the first view was none yet and the first half comes
from a later catalog-revision.

Builds: design 47 G §200, A-327, A-336

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 02:41:39 +01:00
jschoubben 8af822e3fd SDK (A-324, A-325): one PackedOrFetched for the seed and the runner
The rule of an artifact the builder packs or fetches itself was written twice,
in the indexer's seed and in the runner's placing; both now read the one in
mesh-delivery-sdk's buildstep, the contract of a build step every delivery
part reads.

Builds: design 47 G A-324, A-325

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 02:33:38 +01:00
jschoubben 59b46be0d2 Indexer (A-326): a branch take-in keeps no revision with a refused cycle
The trunk's take-in refused a cycle with a build edge, but a branch other
than the first kept its revision with one. The branch path now applies the
same rule before keeping its entries and says the cycle, as it says heads it
could not read.

Builds: design 47 G §49, §51, A-326

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 02:32:23 +01:00
jschoubben 78cf4e7666 Assigner (A-334): hold a group member's end until the graph says which module is the runner
The runner was learnt in memory at the first pass, so a group's runner
pipeline-ended heard before it was acknowledged and dropped, and the runner
was never wanted ahead of its group. Such an end is now kept unacknowledged
until a pass reads the runner from the acting edges, then taken.

Builds: design 47 G §29, §65, §268, A-334

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 02:30:13 +01:00
jschoubben 8ef266ad6f Runner (A-327): a registration heard before the runner can place from it is not lost
A registration-changed heard before the registrar was stored, or before the
branch's catalog half was held, placed nothing and was gone: its pipelines kept
no steps. The half becoming held and the registrations' first view now place
every running pipeline with no steps whose registration is held (Waiting), and
the first view also picks up each held branch whose readiness came before the
resume callback was stored.

Builds: design 47 G §21, §23, §54, §88, A-327

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 02:30:13 +01:00
jschoubben 36be6f31df Merge main into feat/47-G-join11 (G takes in main before its push)
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 02:16:56 +01:00
jschoubben c68d51b8b5 Assigner (A-334): in a group that changes the runner, the runner's member is wanted on its own end
In a group take-in that changes the runner, the other members' pipelines are held for the new runner, so the
group never ended before the bound and the new runner was never wanted. The runner is the acting part the
others wait on, so it goes first as the node-engine does: its member (the holder of the seat
mesh-pipeline-runner, read from the acting edges) is wanted on its own pipeline-ended once that passed, ahead of
the group; the other members keep the group's end.

Builds: design 47 G §29, §65, §268; A-328, A-334

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 02:16:00 +01:00
jschoubben a90412c7a6 Runner (A-328): never hold the runner's own pipeline for its new version
A take-in that changes the runner held its own pipeline with the others, so its new version could not be wanted
before the 30-minute bound and its change was judged by the old runner. The runner's own pipeline now runs on the
running runner, as a build module's running version builds its successor; its pass lets the new runner be wanted,
whose running releases the held ones. The bound stays as the failure bound, with its finding.

Builds: design 47 G §29, §65, §270; A-328

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 02:12:39 +01:00
jschoubben e557168e6e Runner (A-327): a registration-changed places the steps of its module's pipelines started before it
A pipeline started before its module had a registration kept no step for ever: Resume asks only placed steps.
On registration-changed the runner now places, from the registration, the steps of every running pipeline of
that module that has none, by compare-and-set so once each, asks them and says it; until then the start says
the pipeline waits on its module's registration.

Builds: design 47 G §21, §23, §54; A-327

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 02:11:28 +01:00
jschoubben c2e2ac82fa Indexer (A-333): a package-only cycle is not refused, and no delivery edge ends at a package
The cycle rule A-326 built refused today's trunk catalogue and G's own: a cycle of package edges alone (imports given to
every artifact of a module) and a kind-6 edge into a contracts package closing a cycle. A package is delivered only inside
what uses it, so no edge of kinds 2, 4, 5 or 6 is made into one, and a cycle of kind-1 edges alone is left to the
language's build. The dry run's entries of both catalogues are kept as test data and accepted.

Builds: design 47 G §47, §49, §51; A-326, A-333

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 02:09:34 +01:00
jschoubben df02ee40fd Indexer (A-326): refuse at take-in a cycle with a build edge no build seat's running version breaks
The take-in computes the revision's catalog graph over its dry run and refuses one whose edges hold a cycle with
a build edge (kind 1 or 3), naming every artifact on it, as a refusal by its validation is said; a kind-3 edge out
of a module holding a build seat into an artifact that seat builds breaks the cycle at the running version.

Builds: design 47 G §49, §51, §270; A-326

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 02:06:23 +01:00
jschoubben 73582f92e1 Assigner: the node-engine's want first; the acting-wait check sees cycles across steps
The assigner and the node-engine on one node waited for each other for ever: the assigner's
want in step compose for the new node-engine, the node-engine's in step place for the new
assigner, and the cycle check counted one step at a time, so nothing said it. The node-engine's
own want (the holder of the seat node-engine on the node, read from the acting edges' seat) is now
held by no acting edge, so it is written first and the node's other wants, the assigner's own
included, wait for it. Cycles finds a cycle across steps as well as within one, and a want held
on a cycle no rule breaks is the finding acting-cycle (scope module, id <node>.<module>), naming
each edge's step, cleared by the next pass that finds it on none.

Builds: design 47 G §49, §268, §272, A-323, A-330

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 01:56:48 +01:00
jschoubben ab31847d4e Seed and runner: an archive or upstream artifact has no steps; a module no seat builds is left out by name
The seed refused whole at the first artifact with no build seat: 134 archives and upstream
artifacts have none, so no first registrations were ever proposed. The seed now calls no build
seat's steps for an archive or upstream artifact with no language and seeds its lint, unit and
integration as bypass; the runner places those steps bypassed, asked of no one. A module with an
artifact whose language or kind no build seat serves is left out of the seed alone, named in the
ask beside the unprotected branches, with the finding seed-left-out (scope module, id the module)
naming the artifact; it clears only when a later seed finds a build seat for every artifact of
it, or the module left the catalogue.

Builds: design 47 G §8, §23, §28, §535, §704, A-324, A-325, A-329

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 01:52:07 +01:00
jschoubben 5812a2f97d Runner: an image artifact's steps are asked of the seat on kind:image
Place named an image's build seat by "kind: image", a form no seat definition writes, so every
image artifact's lint, unit and integration steps ended could not run. It now uses the seat
definition's own form, seatdef.OnKindImage ("kind:image"). No other kind constant has the space.

Builds: design 47 G §324, §397

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 01:47:23 +01:00
jschoubben ad7e580918 G1 grants-process-bus-requires: a process's account publishes on the events stream and writes the states its module asks for in requires
mesh/delivery merged: source.main moved to novox/mesh-delivery@7c0492b06c37
mesh/delivery-group group feature/1979-zfs-owns-zfs merged: every member is merged
mesh/check being carried to ad7e58091801 on 7c0492b06c37 | from 7221a1e5cd7f, mesh-catalog 117f933dacf0, mesh-host 0193949efe9f, mesh-sdk e42b9491c931…
Builds: design 42 zfs-owns-zfs §25, §26, A-37, A-38
2026-11-13 01:27:58 +01:00
jschoubben 3aca67b9d0 V5 judge-process-bus-requires: a process's bus may name the events and states its module asks for in requires
Builds: design 42 zfs-owns-zfs §25, §26, A-37, A-38
2026-11-13 01:27:58 +01:00
jschoubben e1db8701b5 V4 judge-not-managed: a config value with neither a default nor required is accepted
Builds: design 42 zfs-owns-zfs §11; answer A-14
2026-11-13 01:27:58 +01:00
jschoubben e9eac06e5d V3 judge-config-json: a file holding ${config-json} places every config value of its module
Builds: design 42 zfs-owns-zfs §9; answers A-15, A-24
2026-11-13 01:27:58 +01:00
jschoubben ff76ee95ad V2 judge-config-lines: the form ${config-lines:<key>:<prefix>[:mib-bytes]} is judged and places its key
Builds: design 42 zfs-owns-zfs §3; answers A-4, A-5, A-24
2026-11-13 01:27:58 +01:00
jschoubben 27c3b9a860 V1 judge-if-config: a resource's if-config names a declared config value and places it
Builds: design 42 zfs-owns-zfs §2; answer A-24
2026-11-13 01:27:58 +01:00
mesh-tools 7221a1e5cd Merge pull request 'checker_ask_again recovers a lost check that names no ask, when no check ask waits in any build stream' (#210) from fix/1373-ask-again-no-ask into main 2026-11-12 23:53:51 +00:00
jschoubben 2ab74991b8 checker_ask_again: an unread backlog and a recheck ask refuse too (issue 1373, review)
mesh/delivery merged: source.main moved to novox/mesh-delivery@7221a1e5cd7f
mesh/check checking 2ab74991b856 on 7221a1e5cd7f
Principle 3: unread is never empty. build_usage's notes refuse; a waiting or held recheck ask refuses like a check ask.

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 00:48:36 +01:00
jschoubben b6e61fe63d checker_ask_again ends a lost check that names no ask when no check ask waits in any build seat's stream (issue 1373)
Quick fix: a running verdict whose asks state names no ask is asked again when mesh-delivery-view's build_usage backlog shows
every check stream with 0 waiting and 0 held and no unreadable row, and no step of the candidate runs; otherwise it refuses,
naming the stream that holds asks. Adds the invoke mesh-delivery-view.build_usage to the checker's manifest.
Thorough fix (not built): a group check asked while a lone member's own ask ran was swallowed by the checker's claim of one
check per candidate; noted on issue 1373.

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-13 00:43:32 +01:00
jschoubben 63f944b525 B2 (watchman): invoke the branches follower's three seat verbs
mesh/delivery-group group feat/47-G-join11 rejected: composed together: the checker's verdict at the members' heads (69ffef340e92): mesh-delivery-checker
mesh/delivery closed: a newer head of the same pull request
mesh/check failed (2): mesh-delivery-checker: no published of the tagged version of go-meshconditions of me…; and 1 more | 63f944b52564 on 7221a1e5cd7f
Builds: design 47 G (A-296, A-298)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 23:59:37 +01:00
jschoubben ec7e672c1f B2 (watchman): the wants are followed at the holder of the seat mesh-wants, the indexer's tools at the holder of mesh-catalog
FollowSeat(mesh-wants, wants) replaces the follow by the assigner's module; the pulse and stuck keys name the holder's real
bucket taken at each use (WantsAt, AwaitsWants), a start never waiting for it and the seeded keys of any `<holder>_wants`
kept until the late read (A-321). indexer_pending and indexer_verdicts are asked of the holder of mesh-catalog on each
call. The one catch-all of the seats' events is one handler per seat (A-322), source-moved taken from the branches
follower (AdoptEvent). The manifest consumes the seat's views and the seat-holders view.

Builds: design 47 G A-210, A-318, A-321, A-322, §428

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 23:47:59 +01:00
jschoubben 8e06b6af65 B1 (enrolment): the enrolment's own module is the one the runtime serves it as
enrolment.Module is gone: the finding writer, the reader, the warrant record, the log lines and the ask's bound act name
the served-as module (ownModule, the holder's Module).

Builds: design 47 G A-296, §428

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 23:39:54 +01:00
jschoubben 09e736a687 B1 (view): the view's module is its credential's, in the process and in the tools
viewstate.ViewModule is gone; the process takes cred.Module for its reader and emitter, the tools the served-as module.

Builds: design 47 G A-296, §428

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 23:38:40 +01:00
jschoubben 0fffea89b1 B1 (indexer): the indexer's own name is its credential's module, no constant
index.Module is gone: the indexer and its registry carry the credential's module (findings' observer and ids, its own
entry and graph key, the history subject, the views emitter and reader), the tools take the served-as module.

Builds: design 47 G A-296, §428

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 23:37:54 +01:00
jschoubben 1db4728081 B1 (checker): the checker's own buckets, events and asker are named from its credential's module
CheckerModule and the buckets built on it are gone; check.Bucket names a state of the credential's module, the examiner
takes the module as its asker, the tools take the served-as module, and the tools ask the indexer's read tools of the
holder of the seat mesh-catalog on each call (B2's tool addresses for the checker).

Builds: design 47 G A-296, A-210, §428

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 23:35:14 +01:00
jschoubben 07c13b0b9c B1 (builder): the builder's own buckets are named from its credential's module
The versions, bounds, reserved, publish-queue, acted, toolchains-heard and instances buckets were constants naming
mesh-delivery-builder; ownBucketsOf takes them from the module the credential names.

Builds: design 47 G A-296, §428

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 23:32:42 +01:00
jschoubben 33991dafa9 A3: the view tools' usage reader is built by one function main and its test use
Builds: design 47 G A-128
2026-11-12 23:29:33 +01:00
jschoubben 6f03ceac26 A4: a candidate's added modules take the branch the want's code takes
Builds: design 47 G A-316
2026-11-12 23:29:02 +01:00
jschoubben df766ca1db A2: the git seat's repository fixture names a neutral repository
Builds: design 47 G D3
2026-11-12 23:28:25 +01:00
jschoubben b707508d1e A1: the enrolment reads the node-engine's have in its module form
Builds: design 47 G A-318, A-210
2026-11-12 23:28:19 +01:00
jschoubben 1ce48944c7 D1 (view): the provisioner's provisions are read at the holder of the seat mesh-provisioner
Builds: design 47 G A-318

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 23:15:02 +01:00
jschoubben 81cb2d7ab8 D1 (enrolment): the integration bed reads the seat-form states at the seat list's holders
Builds: design 47 G A-210, A-128

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 23:07:47 +01:00
jschoubben 56be952060 D1 (view): the vault's signers are read at the holder of the seat mesh-vault
The view's trust tool reads the signers in the state of the module holding the seat when it reads (seat:mesh-vault.signers in the manifest's reads); the vault's module constant goes.

Builds: design 47 G §428, A-210, A-128, A-318

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 23:03:31 +01:00
jschoubben b289c0d361 D1 (enrolment): the vault's signers and the node-engine's have are read at the holders of their seats
Reads in the seat form seat:<seat>.<state> are resolved by the seat list's holder when read; the manifest reads and invokes follow (seat:mesh-module-assigner.assignments for the holder lookup). The vault's module name goes.

Builds: design 47 G §428, A-210, A-128, A-318

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 23:02:50 +01:00
jschoubben cd9a373067 D1 (view): the view's tools ask the indexer, the assigner and the wants' bucket of the holders of their seats
The tools program asks indexer_read_*, assigner_read_* and indexer_pending of the module holding the seat mesh-catalog or mesh-wants when it asks, and names the wants' real bucket from that holder at each status; the assigner's module constant goes.

Builds: design 47 G §428, §717, A-210, A-300, A-318

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 23:01:34 +01:00
jschoubben 058b2458fb §626 (teller, bridge, runner, watchman): the own-module guards are folded into an existing test each
The four TestNoCode...OwnModule functions became helpers called by TestTheNamesAreTheManifests, TestMergeCallsTheToolOnceAndWritesTheMergedMessage, TestTools and TestNoTickerTimerOrSleep, so no module ends with more tests than its merge base for them.

Builds: design 47 G §626, §428, A-296

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 22:58:54 +01:00
jschoubben 9af3540d28 A-316, A-317 (assigner): the passer writes each candidate with the version and parts of the modules it adds; the propose verb writes the proposal alone
Builds: design 47 G §379, §421, A-316, A-317

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 22:56:06 +01:00
jschoubben 54b9b2ce85 D1 (assigner): the first-view test grants seat-holders to the callers the manifest names
Builds: design 47 G §717, A-298, A-302

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 22:53:23 +01:00
jschoubben bc8d3e1499 D1 (assigner): the states the views family says are named when it starts, not when the package loads
viewedStates read the module before the start had said it, so every name began with an underscore at run time; it is a function now.

Builds: design 47 G A-296, §428

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 22:51:06 +01:00
jschoubben de24c7f07c D1 (pipeline runner): the runner's tools take their module from the runtime that serves them
The first views tools name the module the runtime serves them as, not a constant of the runner's name; a guard test finds none in its code.

Builds: design 47 G A-296, §428

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 22:48:09 +01:00
jschoubben 3d058af14c D1 (teller): the teller names its own module from its credential's
Its conditions' keys, its asks' subjects, its reader and emitter, its ends bucket and its tools' first views take the module its credential names (the tools: the module the runtime serves them as) instead of constants of its name; a guard test finds none in its code.

Builds: design 47 G A-296, §428

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 22:47:50 +01:00
jschoubben 1883e6e3e4 D1 (forge bridge): the bridge names its own module from its credential's
Its states' buckets, its stream's subjects and its finding observer take the module its credential names (the tools: the module the runtime serves them as) instead of constants of its name; a guard test finds none in its code.

Builds: design 47 G A-296, §428

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 22:47:02 +01:00
jschoubben d7b53bf2f1 D1 (watchman): the watchman names its own module from its credential's
Its finding observer, its dead-letter consumer, its reader's module and its tools' first views take the credential's module (the tools: the module the runtime serves them as) instead of constants of its name; a guard test finds none in its code.

Builds: design 47 G A-296, §428

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 22:46:17 +01:00
jschoubben 2a85e55d4e D1 (assigner): the assigner names its own states from its credential's module
Its buckets (the seat's states, wants, asks, puts, waits, findings, policies, pins, marks, first views) are functions of the module SetModule was told at its start (its credential's; the tools program's served-as), no longer constants of its name.

Builds: design 47 G A-296, §428

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 22:44:33 +01:00
jschoubben 39db267630 D1 (builder): the builder names its own module and buckets from its credential's module
Its states' buckets, its finding observer, its build log entries and its step asks' asker take the credential's module (tools: the module the runtime serves them as) instead of constants of its name; builds.StateBucket/BuildsBucket replace the Bucket constants. The readers of the builds bucket (checker, view, grants) still name the builder: the next D1 subtask finds it by the seat mesh-builds.

Builds: design 47 G A-296, §428

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 22:34:08 +01:00
jschoubben 2271b805bb D5 (sdk, indexer): the answer store is the steps state's own steps-objects; a state template takes objects-max-mib
Builds: design 47 G A-313, A-314

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 22:30:36 +01:00
jschoubben d2ba93abcd D4 (sdk, checker): a compose request's manifest names its fingerprint beside its digest
composer.Manifest gains Fingerprint (wire {"digest","fingerprint"}) and Fill's get takes the Manifest. The checker fills it from a
pull's fingerprint, else from the trunk revision's entry of the module (repoModules keeps each entry's fingerprint).

Builds: design 47 G A-310

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 22:22:07 +01:00
jschoubben 4ba52d9ab7 D3 (contracts): the fixtures and contract tests G adds name roles, not nodes and the operator
Nodes read anchor, home-server, laptop, workstation (in the order the node names sorted) and a person reads alice.

Builds: design 47 G A-296 (review round 2 D3)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 22:18:30 +01:00
jschoubben b056f32c13 D2 (view): build_usage reads the build seats' steps and pauses as seat reads in the holder's state
The manifest reads seat:<seat>.steps and .pauses, which the grants part resolves, and the tools read <holder>.steps and <holder>.pauses.

Builds: design 47 G A-82, A-128

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 22:17:20 +01:00
jschoubben 406e17446f The runner's process is judged by its unit, not by its own tool runner_health
A process is never judged by a tool of its own; the pipeline runner's health is now the unit, as every other process of
mesh-delivery declares. runner_health stays a tool.

Builds: design 47 G A-305; ADR 0227 rule 8, ADR 0240 rule 2

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 21:49:32 +01:00
jschoubben 7b9904b1fe The checker puts every ask of a phase at once, then waits for them all
judgeAll put one check ask and blocked in its wait before the next. Within each of its two phases (the modules that are
not TypeScript, then the TypeScript modules once groupPackages is read) every ask is now put first and waited for on its
own goroutine; a declined ask is put again there as before, and the steps are judged in the order the asks were put,
so the verdict reads as before whatever order they end in. The ask splits into prepareAsk, putAsk, wait and judgeAsk;
the placed ask of unmet packages stays one after the other.

Builds: design 47 G A-304, ADR 0525 §4

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 21:39:20 +01:00
jschoubben f468aa75e8 N3 (mesh-enrolment): the enrolment names no bucket of its own
Its state enrolments is the runtime's bucket of the credential's module; the constant `mesh-enrolment_enrolments` was read
by its tests alone, which now name the bed's bucket themselves.

Builds: design 47 G A-296

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 20:40:34 +01:00
jschoubben 3ac9947dc8 N3 (forge bridge): the bridge names its own buckets heads and inputs from its credential's module
Both were constants of the module's name; they are now `<module>_heads` and `<module>_inputs` of the credential's module.

Builds: design 47 G A-296

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 20:40:14 +01:00
jschoubben 29517d702c §717 (3), the status view follows the assignments, the wants and the asks by their seats, at the holders the seat-holders view names
The status view's process followed mesh-delivery-assigner's assignments, wants and asks by module name. It now follows them
through views.ProcessReader.FollowSeat with the catalog half's holder function (A-298), its pictures named in the seat form
(mesh-module-assigner_assignments, mesh-wants_wants, mesh-wants_asks); the watchman's stuck key of a want, which names the
holder's real bucket, is read at each use from the holder followed (ProcessReader.HolderBucket), and the tools program,
which reads the wants of the assigner's tool (A-300), names that module's bucket. The process names no module of the
assigner. The bed serves the seats' views at stand-in holders the claimant's seat-holders view names.

Builds: design 47 G §717, A-298, A-300, A-303 (corrected)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 20:38:44 +01:00
jschoubben 43f6b57ab2 Main's subject takes the checker's check and recheck again, as A-184 says until it goes
The asker rename (d29e1426) let main's subject, which names no asker, take only a build and a run, so a holder refused the
checker's check asks ("the kind check is not taken on main's subject"), and seven of the checker's eight integration tests
failed. Until main's subject goes it also takes the checker's check and recheck; a step there is still refused.

Builds: design 47 G A-184, §543

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 20:30:13 +01:00
jschoubben cd8afa47d9 The teller reads the router's record outside its lock, so a catch-up never holds a warrant
catchUp held the teller's lock across the router's record read (Where, through operatorask.Bucket and seatlist.HolderOf,
which retries); with no answer it blocked the module's event pull, whose Said waits on that lock (met when an ask arrived
inside a first view). OnAssignerAsk now catches up after it let go of the lock, catchUp takes the lock only once the record
is read (an asking no longer open by then is left), and OnCurrent reads the records of the asks asked again outside the
lock in the same way.

Builds: design 47 G §717 (the teller raises the assigner's asks whether or not anything else answers, issue 1906); principle 3

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 20:19:06 +01:00
jschoubben 04bfc92d3d §717 (3), the builder, the checker and the indexer follow the assignments by the seat, at the holder the seat-holders view names
buildrun's AssignerHolder asked the seat's verb for the holder every 5 seconds. The builder and the checker now follow
mesh-module-assigner's assignments through views.ProcessReader.FollowSeat with the catalog half's holder function (the
checker gains the catalog half's reader of §614 for it); the indexer reads the claimant from its own catalog
(Indexer.ClaimantNow) and follows its seat-holders view again at each refresh of its build modules. AssignerHolder goes; the
manifests consume the seat-holders view (the checker also the catalog half's events and verbs), and the assigner's
seat-holders first-view tool answers the checker and the indexer. The beds give each part a claimant and a seat-holders view
in place of the seat verb's answer; the indexer's beds hold the claimant from the start, so the merge test reads the newest
revision.

Builds: design 47 G §717, §614, A-298, A-302

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 20:17:36 +01:00
jschoubben 2165b3b296 §717 (3), the teller: it follows the asks and the answers by their seats, at the holders the seat-holders view names
The teller followed mesh-delivery-assigner's asks and mesh-delivery-view's answers by module name. It now gains the catalog
half's reader (§614), whose claimant of mesh-module-assigner's seat-holders view is its holder function (A-298), and
follows mesh-wants' asks and mesh-delivery-view's answers through views.ProcessReader.FollowSeat, each apart (issue 1906):
started before any module holds a seat it waits, and follows the holder once it is placed and as it moves. Its code names
neither module; its manifest invokes the catalog half's revision and the gate's source, and consumes the seat-holders view,
catalog-revision and source-moved; the assigner's seat-holders first-view tool answers the teller (A-131's module form).

Builds: design 47 G §717, §614, A-298, A-295, A-296

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 19:55:29 +01:00
jschoubben 8fa8289a6a §717 (2), the status view: it follows the assigner's views by their seats
The status view consumes seat:mesh-wants.views.asks, seat:mesh-wants.views.wants and
seat:mesh-module-assigner.views.assignments in place of the three mesh-delivery-assigner.views
entries, and its process takes each first view from the tool named for the state; its invokes
lose assigner_read_asks and assigner_read_assignments, and its tools program keeps
assigner_read_wants for a want's key and history reads (A-300).

Builds: design 47 G §717, A-300

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 19:36:17 +01:00
jschoubben c3fd29a64c §717 (1): the status view's answers are a view of the seat mesh-delivery-view
The Delivery contracts module defines the seat mesh-delivery-view (scope mesh, grain whole,
ADR 0540): no verb, no seat event, no family, one state answers (template state, history 5,
view), one key form per kind of mesh-wants' asks with .view after it (A-299), its value the
answer (v, asking, option, words); seatgen writes its Go and TypeScript packages, and the
module's artifacts name them. The status view claims the seat (scope mesh, serves none), its
first-view tool answers (views.FirstViewTool, callers the teller, A-301) replaces
view_read_answers, and it deletes its answer once the ask's key has left asks. The teller
follows the answers by seat:mesh-delivery-view.views.answers and invokes nothing of the view's.

Builds: design 47 G §717, A-299, A-301

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 19:35:37 +01:00
jschoubben 1bac48e84e §717 (2): the assigner's asks and wants are views of the seat mesh-wants
The seat mesh-wants' definition gains the state asks (template state, history 5, view), its key
forms the seven kinds' keys as the assigner's asks package writes them (hold, restore, backup,
record, outside, revert, assignments) and its value the ask as the assigner composes it; its
wants gains view. The assigner's first-view tool asks replaces assigner_read_asks, its callers
the teller and the status view; the status view joins the callers of wants and assignments.
The teller follows the asks by seat:mesh-wants.views.asks and invokes nothing of the assigner's.
The status view's part waits on a question (its tools ask assigner_read_wants).

Builds: design 47 G §717, A-299

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 19:29:57 +01:00
jschoubben cf93d30150 Names N3 (indexer): the indexer names its own buckets from its credential's module
Its 26 `<Module>_<state>` bucket constants (candidates, manifests, verdicts, packages, taken, the
control records, pins, pending and the rest), its consumers, findings and first views were named
from the constant Module; they are now index.Bucket(cred.Module, <state>), and its words name
the state where they named the bucket.

Builds: design 47 G A-296

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 19:18:56 +01:00
jschoubben 0de534c692 Names N3 (view): the status view names its own buckets from its credential's module
Its states answers, reach and waits (viewstate WaitsBucket, ReachBucket, ViewAnswersBucket), its
first views and its marks were named from the constant ViewModule; they are now
`<cred.Module>_<state>` (viewstate.BucketsOf), and the model is made for its module.

Builds: design 47 G A-296

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 19:14:55 +01:00
jschoubben e8d1bf96be Names N3 (watchman): the watchman names its own buckets from its credential's module
Its states presence, pulse and stuck and its first views were named from the constant
WatchmanModule; they are now `<cred.Module>_<state>` (watch.BucketsOf), and the watchman's
stuck keys of presence take its own presence bucket's name.

Builds: design 47 G A-296

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 19:09:46 +01:00
jschoubben 4938fb2d73 Names N2b: every seat list part's callers name seats, resolved from the seat-holders view
The builder, its tools bundle, the assigner (process and bundle) and the view's tools bundle answered
their seat list's again tool to the modules node-tools and mesh-healers. Their lists are now the
operator, seat:node-tool-runner and seat:mesh-healers, resolved by a holder function:
- meshcatalogclient's Branches.Claimant (moved from the builder's versions.HolderOf, which now asks it)
  names the claimant of mesh-module-assigner from the trunk's half, and Branches.SeatHolders follows
  that claimant's seat-holders view through the part's wiring. It drops the view and follows the new
  claimant's on a catalog change, asks nothing on a timer, and answers seatlist.HoldersIn.
- the assigner answers HoldersIn from its own seat-holders picture (its world in the process, the
  watched copy in the bundle).
The builder's and the view's manifests consume seat:mesh-module-assigner.views.seat-holders. The
assigner's seat-holders first-view tool answers both, by module as A-131 has it.

Builds: design 47 G A-298, A-295, A-296, A-210, A-131, §717, §616, §614

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 19:05:51 +01:00
jschoubben 5943cd87a1 Names N3 (teller): the teller names its own buckets from its credential's module
Its states answers, asked, widens-said, first-views, teller-marks and findings were named from the
constant tellerModule; they are now `<cred.Module>_<state>`, so the part keeps no name of its own
module for what it owns.

Builds: design 47 G A-296

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 18:58:14 +01:00
jschoubben 03b7b6ed24 A-297: the runner's step ask id takes the usual ask id form, so the holders accept it
The runner's step ask id was `step-<24 hex>`; every build seat holder's CheckAskID refuses it (base 36
milliseconds and six hex digits), so no placed step could be accepted. AskID now opens with base 36 of
the pipeline's start time in milliseconds and ends with six hex digits of the sha256 of the pipeline,
the artifact and the step: the same placement makes the same id at every start. A rerun uses its own
time.

Builds: design 47 G A-297, A-232, A-111

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 18:50:29 +01:00
jschoubben c529ca259f seatgen -check passes at the join: the catalog client's test imports no bus client
branches_test.go named nats.ErrNoResponders for a call that reached no holder, so the generator's
check refused the contracts module ("a client uses only its seat's contract and mesh-sdk's runtime",
ADR 0625 §3), met twice at join 11. The test now gives the words a runtime passes that refusal on
with, which busretry.Undelivered reads the same way.

Builds: design 47 G A-170 (the regenerated contracts, checked in place)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 18:40:16 +01:00
jschoubben 13edd34daa Names N1: the builder fixes no module name of the gate, the checker or the indexer
The three constants named modules the builder no longer calls or reads: the gate and the checker
by nothing, the indexer only by a test's stand-in of a tool the builder stopped calling when the
catalog half named the requirements (A-119). A deletion: nothing reads them.

Builds: design 47 G §7, §428, A-210

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 18:39:26 +01:00
jschoubben d29e1426d0 Asker rename R2: every asker of a build seat asks under its seat's own name, and its step is keyed so
A-163: the asker in `accept.<queue>.<asker>` is the asking seat's name (mesh-pipeline-runner,
mesh-catalog, mesh-wants, mesh-builds), never a nickname: the builder asks as mesh-builds (was
"builder"), the indexer's validation as mesh-catalog (was "indexer"), the assigner's runs as
mesh-wants (was "assigner"), the runner's steps on `accept.check.mesh-pipeline-runner` and
`accept.delivery.mesh-pipeline-runner` (were `accept.check.step` and `accept.delivery.step`, where
the holder read `step` as the asker). An asker naming none (the checker) asks on main's subject
(A-184). A build seat's queues are delivery, check and recheck alone (A-170, A-184): buildstep's
AskKinds holds no step, a holder takes a step from check or delivery, and the grants part makes a
worker per queue, never per kind. A holder keys a named ask's step `<asker>.<node>.<id>` and main's
`<node>.<id>` (§481, §483); readers watch their own name's keys. The composition step's step-progress
names the one caller mesh-wants' definition lists for step, read from the seat list (A-294).

Builds: design 47 G §481, §483, §543, §600, A-163, A-170, A-184, A-248, A-294

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 18:37:29 +01:00
jschoubben 4851475773 Asker rename R1: a build seat's streamed kind is sent on its queue's subject, the kind in the body
The generator wrote `accept.<stream>.<kind>` for a kind that rides a stream (step on check and delivery,
run on check), so the runner's step landed under the named worker `accept.check.*` with `step` read as
its asker. A-170 has the kind in the body only: the generated accept subject of a streamed kind is the
queue's, `accept.<stream>`; its generated names stay `<stream>.<kind>`. The three build seats'
contracts and fixtures are regenerated.

Builds: design 47 G §600, A-170, A-184

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 18:23:48 +01:00
jschoubben 93ecfc7f1f A-290 B2: every reader reads a step's answer from its key or the object it names
The shared asker (buildrun.Asker.Wait) answers an ended step whole: a key naming its answer as output-object has it read
through the build seat's verb output on the step's node (Step.Whole) with the asker's Outputs, so the checker's judge,
manifests judge, checking program and compose sandbox read the answer as before; a step whose object cannot be read is
the wait's error. The checker reads its run asks' failed key's answer for a program that exited other than 0. The
checker, the indexer and the assigner read a kept answer through process.Conn.CallFile (A-291), which receives the
verb's chunks; the checker's manifest invokes the three build seats' output.

Builds: design 47 G A-290, A-291, A-254

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 16:50:54 +01:00
jschoubben 386095bd53 A-290 B1: a step answer over the steps state's bound is kept as the object its key names
A step's key keeps its answer only within what the steps state holds per value (kvlimit.ModuleStateValueBytes less
the headers' room). Over it, finish keeps the answer with the holder's KeepOutput as the object output.<ask> in its
outputs store and the key names it in output-object: a check's whole answer, its result emptied; a run's output, the
key keeping the run answer without it. An answer that cannot be kept ends the key failed, saying why. The Puller says
step-ended from the end finish wrote, so the key and the event say one outcome: a run whose program exited other than
0 ends its key failed as well, its answer kept; step-ended names the object finish kept instead of putting it twice.
Step.Whole reads a key's object back through the seat's verb output on the step's node. The part build-step's Step
gains output-object, the verb output says it answers a step's answer; fixtures and the generated contracts follow.

Builds: design 47 G A-290, A-254, §467

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 16:44:07 +01:00
jschoubben 9fdd8a76c2 U2c: a package left unpublished by a build that reserved no version counts as done
The builder's unpublished count held every package without a reference and named the Node
build module for all of them, so a Go package built by a build reserving none (another
watched branch, a manifest with no MAJOR.MINOR, a candidate) left its key never done and
was sent to the wrong seat. A reserving build's package is published under its version or
its build fails, so the count now holds images alone.

Builds: design 47 G A-289, §371

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 16:15:41 +01:00
jschoubben e313248b5f U2b: the reserved version reaches each artifact's build, and a versioned ask names each artifact's registry seat
The ask carried the reserved version (§573), but the build modules' shared run gave each
artifact's build only the artifact's own version, which no asker sets, so no build got
MESH_VERSION and a Go package was packed as a candidate and never published. The run now
gives every build the ask's version, and the builder names the registry seat each artifact
of a versioned build is published through, so a Go package is published under its
reserved version on go-package-registry.

Builds: design 47 G §370, §573, §458; design 51 *Publishing*

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 16:13:13 +01:00
jschoubben 4332246f79 U2a: the builder plans a Go package on the Go build seat instead of refusing it
A module whose only artifact is a Go package (mesh-wireguard's go-overlay) never had a
done build: PlanOf refused every package of language go. The Go build module already packs
and publishes a Go package; the builder now asks it.

Builds: design 47 G §370; design 51 *Publishing*

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 16:13:13 +01:00
jschoubben 1550131792 Join 11: checkermsg carries the go.sum lines of the modules its packages load
01fb2e13 named nats.go and its dependencies in checkermsg's go.mod but left the go.sum
lines uncommitted, so the fetch's proof (both build tags, GOPROXY=off) refuses the
module with "missing go.sum entry" on any clean clone.

Builds: design 47 G (the join's guard rule)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 15:59:04 +01:00
jschoubben c4e8b51694 Join 11: merge mesh-delivery main (the checker previews a member whose fetch merged)
Main brought #208 (24d9c6cd), the quick fix of the checker's preview after a failed
step; G holds the same change in 5fbc366f, so G's side is kept where they meet
(judge.go: G's per-member merged list, no group tag versions). The tree is G's.

Builds: design 47 G A-286

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 15:48:07 +01:00
mesh-tools a5d7108631 Merge pull request 'The checker previews a member whose fetch merged, whatever its later steps ended with' (#208) from fix/checker-preview-after-failed-step into main 2026-11-12 14:34:09 +00:00
jschoubben 6e16742446 A-284, A-285: a group's check gives every TypeScript fetch the packages the group changes
The fetch's single `package` and its tagged form go; `group-packages` lists each
TypeScript package a member's merge changes, at the member's head with its
directory there. The checker asks every member's other fetches first, so every
merge's changed paths are known before any TypeScript fetch, and gives each the
whole list; the registry's version stays only for a package no member changes.

Builds: design 47 G A-284, A-285

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 15:30:22 +01:00
jschoubben 24d9c6cdf8 The checker previews a member whose fetch merged, whatever its later steps ended with
mesh/delivery merged: source.main moved to novox/mesh-delivery@a5d710863157
mesh/delivery-group group fix/checker-preview-after-failed-step merged: every member is merged
mesh/check checking 24d9c6cdf8d9 on a5d710863157 | novox/mesh-delivery#208 in group fix/checker-preview-after-failed-step
A member whose check step errored after its fetch merged was left unpreviewed,
so one failing level hid the manifest validator and the composition from the
check, and the words "its head does not merge or its fetch did not answer"
were wrong for it. The checker now reads the fetch a failed step answers
beside its error and previews the merge from it; only a head that does not
merge or a fetch that did not answer stays unpreviewed, and the check says
which of the two.

Builds: design 47 G A-286 (G-22-lead-answers-2.md at hq 41dd30fe; issue 1921; principle 3)
Quick: this checker on main; thorough: the same rule in G's checker (join 11, J15).

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 15:25:44 +01:00
jschoubben ee338479ad Join 11: the indexer's seatfiles requires mesh-sdk at the zero version, not at a commit
A go.mod requires a mesh package at the zero version only, and the check builds it against the
group's head or the latest published version (ADR 0573 §2, §4). seatfiles still named mesh-sdk at a
November 4 commit; the fetch proof's new guard refuses that.

Builds: design 47 G (join 11, the check's shut-off build of the group's modules)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 15:19:30 +01:00
jschoubben 5fbc366f1b A-286: a member whose fetch merged is previewed and judged whatever its later steps ended with
A check step that errors after its fetch merged ends failed with its answer (the fetch and the levels so far)
beside its error (steprun askrun.go), and the checker previews the merge from it (judge.go), so a failed level
no longer hides the manifest validator and the composition (try 2: catalog, contracts and delivery were
unpreviewed by a seatgen bootstrap failure, not a conflict). Only a head that does not merge or a fetch that
did not answer stays unpreviewed, and the check says which.

Builds: design 47 G A-286 (hq 41dd30fe)
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 15:19:14 +01:00
jschoubben 01fb2e13ca Join 11: pipeline, checkermsg and meshcatalogclient name every module their packages load
The same gap as restic's in the catalogue: mesh-delivery-pipeline loads nats-server through testbus with neither its
requirement nor its sums; checkermsg loaded nats.go and its requirements with no require line; meshcatalogclient
required klauspost/compress below the version its graph selects. Each now passes go list -mod=readonly -deps -test
against the group's heads with GOPROXY=off, both build tags.

Builds: design 47 G (join 11, the check's shut-off build of the group's modules)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 15:00:49 +01:00
jschoubben e82e5a57ad Join 11: every go.mod requires, at the zero version, each mesh module its packages load
The checker's fetch pins only the zero-version requirements a directory's go.mod names
(mesh-build-go workspace.go goModOf), so a module reached only through another, such as
meshhandacts through meshhandactsclient or mesh-delivery-sdk through meshcatalogclient,
was never downloaded and the shut-off load failed (fetch.go:267). The join's merges had
dropped these indirect requirements that the trunk's go.mod files list.

Builds: design 47 G (join 11, the check's fetch of the group's modules)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 14:07:29 +01:00
jschoubben af772096d7 Join 11: merge origin/main (the indexer says a merged manifest accepted, issue 1966)
sayHeld stays in G's judgeOverHeld, after the written-verdict branch, for a fresh trunk manifest
whose verdict the pass did not write. The test's merged manifest is written as the candidate's
own text ("2.0"): the join's manifest digest is of the raw bytes (meshcatalogclient
ManifestDigest), so "2" was another manifest and the test stopped before the case it adds.

Builds: design 25 bus-state §1 (merged from main)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 14:07:13 +01:00
mesh-tools 76db40eb6b Merge pull request 'The indexer says a merged manifest accepted, so a new build gets its part grant without a hand act (issue 1966)' (#207) from fix/1966-new-build-grant into main 2026-11-12 12:28:38 +00:00
jschoubben 299f0b56e0 Join 11: the toolchain-change test leaves no old toolchain report for the builder to agree on first
Cause: the bed reports go1.27.1 for both nodes at its start, and the test then reports go1.27.2. The builder's new
durable on EVENTS hears the old reports first, so for a moment it agrees on go1.27.1 (said as toolchain-agreed
go1.27.1 by n1, seen in a run's EVENTS); a netcheck entry heard in that moment is built at its old fingerprint
("the old fingerprint, naming go1.27.1, was built with go1.27.2", integration_test.go:767, twice on 2026-11-12).
The builder acts as ADR 0465 says on what it heard; the bed told it a story the test does not mean. The test now
purges the bed's go reports before its own, and asserts that no toolchain-agreed of go1.27.1 is ever said.

Builds: design 47 G §492, §604, A-282

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 13:26:58 +01:00
jschoubben 347db8d4fd Join 11: the builder sets all of the catalog half's wiring before its views reader starts
The floor wake (half.floor), the builder (half.b), ready and branches.Changed were set after reader.Start, so a
catalog view heard on the reader's goroutine read them while main wrote them: the race detector named
catalog.go:117 against main.go:501 in TestBuilderMakesADoneKeyWithTheDigests. They are now set before the start;
the builder cmd integration package then ran 21 times under -race with no race.

Builds: design 47 G §614, A-119

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 13:26:58 +01:00
jschoubben 104909817b indexer: say manifest-accepted for a merged manifest a pull request's judgement already accepted (issue 1966)
mesh/delivery merged: source.main moved to novox/mesh-delivery@76db40eb6be1
mesh/check being carried to 104909817b70 on 76db40eb6be1 | from 983c46e2576c
A pull request's candidate is judged before its merge and its verdict written, said nowhere. At the merge the
digest becomes the module's trunk manifest, but the merge's judging pass finds the same verdict, writes nothing
and so said nothing: the bus module never heard the new manifest, and the grants part, which follows the
verdicts on manifest-accepted, held the module as having no verdict and wrote no grant for its new fingerprint
(claude-licence-manager, three times on 2026-11-12). The merge's pass now says a fresh trunk manifest's accepted
verdict from the verdict held, with its revision.

Builds: design 25 bus-state §1, §12.2 (the indexer says manifest-accepted for every newly accepted manifest; the
grants part follows the verdicts on it)

Builds: design 25 bus-state L1 (hq ff30ac16, the lead's answer: a merged candidate's manifest is newly accepted).
2026-11-12 13:20:29 +01:00
jschoubben 339964920b A-282 corrected (join 11): a moved step's bound is written again by a revision-checked update, never a delete
c5a6871f created the key once and never wrote it again, so a step that kept moving was bounded from its first
movement (issue 1930). Arm now creates the key when absent; one ending no earlier is armed already; one ending
earlier is written again by an update against the revision read, carrying the bound's time to live; a waiter
whose update loses reads the key again and takes the newer bound as armed. The test moves a step twice past its
first bound, with two waiters each time, and reads one write per movement, its time to live, and no delete.

Builds: design 47 G A-282, A-115, §544

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 13:16:22 +01:00
jschoubben c663b27848 A-282 (join 11): an ask's step bound key is created once, and a second waiter takes it as armed
stepBounds.Arm deleted the key and created it again, so two builder instances waiting on one ask raced: one's
create met the other's and failed "wrong last sequence", and the ask's build failed (the builder bed's two
instances together). Arm now creates the key only if absent; one already there is armed, and nothing deletes
it to make it again.

Builds: design 47 G A-282, A-115, §544

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 13:13:50 +01:00
jschoubben daa7737392 Item 5 (join 11): an asker's build-seat queue is served by the seat's holders, so the indexer draws its kind-6 edge
An asker names the queue it asks as seat:<seat>.accept.<queue> (A-231); no module's serves lists that form, so
graph.Servers matched nothing and the indexer drew no served-verb edge from a build seat's holders to the asker.
Servers now reads the form through mesh-sdk's catalogue.QueueInvoke and answers every module serving a verb of the
seat; the kind-6 edge asks the module graph's Servers, the one rule, instead of a match of its own.

Builds: design 47 G §544, §605, A-231

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 13:08:40 +01:00
jschoubben 99c21957de Item 4 (join 11): the composition-inputs test guards what each machine was asked
gather asks the machines side by side, and the test's stand-in call wrote one map from each of them: a concurrent map
write, the panic once seen at compositioninputs_test.go:61 (the race detector shows it every run). The record is
guarded; the whole assigner's unit suite runs clean under the race detector.

Builds: design 47 G §354, A-243, A-252

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 13:04:58 +01:00
jschoubben 778bcd0eee Item 2 (join 11): the builder's operator-ask tests check the ask's expiry on the asks' own clock
The asks were made at a fixed time while the channel client checked their expiry against the real clock, so from
2026-11-12 every ask "expires before it is asked". The client now takes the same fixed clock.

Builds: design 47 G §568

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 13:02:03 +01:00
jschoubben 24d0bae793 Item 2 (join 11): the builder's bed declares no build-seat worker beside the SDK's, and answers the seat mesh-builds
The SDK's DeclareAskWorkers now declares each queue's two workers, main's and the named asks' (accept.<queue>.<asker>),
and the puller takes from both; the bed declared main's worker again filtering both forms, which overlaps the named
worker and the work queue refused ("filtered consumer not unique", 15 tests). The kind is a bed declaring by hand
what the SDK declares: the builder's bed was the only one whose own consumer overlaps the SDK's, and now declares
none. Behind it, the builder's seat server admits no caller of mesh-builds.reserved until the seat list holds
mesh-builds' definition (A-278); the bed's seat-definitions answers it from the contracts module's own file.

Builds: design 47 G §544, §600, A-115, A-278

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 13:02:03 +01:00
jschoubben 8e50fab811 Item 1 (join 11): an entry the catalog holder says it holds none of is not-found, so a held want is passed again
A process's call gives the holder's own answer as its error (busretry.Answered); the entries kept by
fingerprint took that for a call that reached no holder and kept the entry asked, so §298's order edge
on the unread entry held the want for good and no pass ran again (the assigner's
TestWantsAreWrittenAndNoDifferenceIs, rule 7 "waits in place for the catalog entry").

Builds: design 47 G §614, §298, A-259, A-260

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 12:56:02 +01:00
jschoubben bec5278a89 Area 7 part 1 (join 11): the assigner's bed takes every seat's events on EVENTS and answers the seat list
The bed's kept streams (running, machine-away, machine-back, version-delivered) took subjects of their own, so a test that
widened EVENTS met "subjects overlap". They now source EVENTS' messages of their subject, as the grants part makes them
(KeptEvent.StreamConfig), and EVENTS takes mesh.seat.*.event.>. The bed answers the seat mesh-catalog's seat-definitions
from mesh-sdk's seatlisttest copy and its verb entry from the catalog half, so the seat server admits a caller once the
list is read (A-278). The composition step test calls input on its subject naming the caller (A-179) and waits for the
seat list read and the sourced running messages. TestTheCompositionStepComposesEachMachineThroughTheBuildSeat passes;
TestWantsAreWrittenAndNoDifferenceIs still fails (rule 7: web on ace held on an unread catalog entry).

Builds: design 47 G §354, §610, A-179, A-278

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 12:38:36 +01:00
jschoubben cdc6e1f521 Item 5, area 8 (join 11): the grants part lets a caller of a marked verb hear its own calls' ends
A holder says a held call's end on its seat's gated-ended, kept last per subject for a day in SEAT_<seat>_gated-ended,
which the grants part makes from the definition seatdef.Resolve gives (A-264). The caller is granted hearing
gated-ended.<caller>.> under its own escaped account name, and an ordered consumer on that stream filtered to it, from its
invokes of the marked verb by name; a module or process that answers a marked verb is granted saying the event to any
caller. No process of mesh-delivery holds a marked verb, so no holder here takes NewGateChannel.

Builds: design 47 G §677, §700, A-264, A-273

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 12:24:48 +01:00
jschoubben 4194e93a67 Area 2 (join 11): every seat verb and build-seat queue a delivery module calls is in its invokes
The grants part grants a seat verb only to a module that names it in invokes (GR8), so a call missing from a
manifest is refused live. Listed every module's seat-verb calls in code (constant clients, seatlist.HolderOf,
operatorask, buildrun's drops and puts) against its invokes: the teller asks who holds operator-channel
(operatorask.Bucket) and the checker drops asks of the image build seat. Every asker of a build seat names the
queues it asks as seat:<seat>.accept.<queue> (A-231): the runner check and delivery, the assigner check, the
builder delivery, the checker check and recheck; the indexer had its entry. The validator judges that form
through mesh-sdk's catalogue.QueueInvoke against the kinds the seat accepts.

mesh-grants: a consumed seat view whose seat has no holder on record grants nothing instead of refusing the whole
module (TestGrants); TestCallersAndWhyRefused and TestSentStoresRead take §610's class defaults.

Builds: design 47 G §544, §601, §610, §616, A-231, A-179

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 12:17:50 +01:00
jschoubben 4f076c6cc3 Area 4 (join 11): the indexer's TestManifestDeclarations reads its readers' invokes in both forms
The readers' invokes are read with mesh-sdk's catalogue.InvokedVerbs, so a long-form {verb, fields} entry (the
assigner's) is read rather than refused by the test's own decode.

Builds: design 47 G A-275, §558

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 11:56:44 +01:00
jschoubben a59e40c02f A-280: the grants part lists a module's finding-events stream in its membership
For a module that requires finding-events and is bound, the membership lists the stream its binding names, the subject
mesh.bus.<module>.finding-events.{event}.<node> and the finding events, so the tool runner carrying a stdio module (the
enrolment) says an emitted finding event there; the test holds the enrolment's membership.

Builds: design 47 G A-280, A-274, §529

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 11:56:08 +01:00
jschoubben af96eeba86 A-274: the watchman, forge bridge, teller and view pass their finding-events binding to the finding writer
Each asks the seat mesh-broker's show for its finding-events entry (process.Binding, started without waiting), passes it
as the writer's Bindings and hears the seat's recreated and dropped; the watchman's one handler of the seats' events
hands those two to the binding, since a message has one taker. The teller, view and watchman manifests gain the invoke
seat:mesh-broker.show and consume mesh-broker.recreated and dropped. The forge bridge's and the watchman's whole tests
answer show and read the finding-written under the binding's subject.

Builds: design 47 G A-274, §529, §577, A-13

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 11:56:08 +01:00
jschoubben 8f7fd39e21 A-277: the manifest validator reads a state's max-mib and judges an approvals state as §677 declares it
The template state takes max-mib (1 to 8192, as the old state section reads it). A state named approvals is refused
without key-ttl true, with ttl-seconds other than 172800 (approval.KeptFor, 48 hours), or with max-mib above 64; with
none declared its bucket takes the default 64 MiB.

Builds: design 47 G A-277, A-270, §677

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 11:42:16 +01:00
jschoubben db3f07d277 A-278: the assigner, builder, indexer and pipeline runner pass seatlist.Definition to AnswerSeat
Their four copies of the seat-definition function go; each passes its seat list part's reader to mesh-sdk's one.

Builds: design 47 G A-278, A-186

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 11:39:57 +01:00
jschoubben 7c461a96ae Join 11: merge main (mesh-delivery #206): the checker's compositions cap and drop tool, the assigner's heard reads-changed
G's grants already carry a state's max-mib onto its bucket (Bucket.MaxBytes, §469); main's second copy of that cap in
BucketStreamConfig and Composed is dropped for G's, and main's tests (the declared cap row, the held bucket raised)
are kept. The checker keeps G's version 0.1 (§368) with main's compositions max-mib 256.

Builds: design 47 G §469, §368; A-277 (since mesh-delivery #206 the grants part carries max-mib)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 11:30:57 +01:00
jschoubben ef142bb8c0 Area 3 (join 11): the runner clears pipeline-waits when its awaited version runs healthy
The finding pipeline-waits was raised at the wait's bound and nothing cleared
it. It now names the awaited runner fingerprint in one evidence entry,
`awaited <fp>`, written when it is raised (A-276), and the runner's hearing of
the node-engine seat's running clears exactly the findings whose entry names
the fingerprint said healthy (A-218), through its held writer, which holds what
its state findings held at its start: a finding raised before a restart is
cleared too, and one awaiting another fingerprint stands. The summary is never
read for it. A clear that fails has the running heard again.

Builds: design 47 G lead answers A-218, A-276 (join 11 area 3)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 11:24:16 +01:00
mesh-tools 983c46e257 Merge pull request 'Grants carry a state's declared cap; the checker's compositions get room and a drop tool; the assigner trusts no stale reads (issue 1975)' (#206) from fix/engine-reads-and-compositions into main 2026-11-12 10:23:30 +00:00
jschoubben 2242ae3c46 Area 4 (join 11): buildstep reads no bus, not even through buscalls
The builder's published package reached the bus library through buildstep,
whose KeptBuildsOf took mesh-sdk's buscalls.ObjectInfo, and buscalls now
imports nats.go for its seat chunks. buildstep's layouts, keys and codecs
are read by modules that never touch the bus (its own guard), so the kept
build of one object is judged from the object's own fields (KeptBuildOf,
SortKept) and the build module lists its store itself. The guard now also
refuses a bus library reached through an import, the kind that let this in.

Builds: design 47 G (join 11 area 4: builds TestThePackageReachesNoBus, buildstep's bus-free guard)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 11:21:29 +01:00
jschoubben bc78e01b6f Area 2 (join 11): the order-wait fixture's machine is online again
The five §298 order-wait tests of b2l (A-245, A-258, A-259, A-260) held no
wait and said none after the merge with b2f: b2l's fixture put ace's presence
as online (presenceValue(true)), and the merge rewrote it as b2f's
heardPresence("ace", true, ...), whose flag says away. With every node away
no module had a canary, so no want moved and no order edge was held (an order
wait starts only on an online node, §268). The fixture now hears ace back;
the order waits are built as those answers have them, unchanged.

Builds: design 47 G lead answers A-245, A-258, A-259, A-260 (join 11 area 2)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 11:17:22 +01:00
jschoubben 9ff6d98820 Area 6 (join 11): every AnswerSeat caller follows a seat list and its grant
AnswerSeat checks a call's caller against the seat's definition its caller
reads from the seat list it follows (A-186), refusing every caller while the
list is unread. The assigner (mesh-wants input), the builder (mesh-builds
reserved) and the indexer (mesh-catalog input) hand it the definition their
seat list holds once heard; the pipeline runner, which followed none, follows
one over its calls connection and hub, read again once its events are live,
and its manifest invokes seat-definitions and consumes the list's two events.
The runner's and the indexer's integration beds answer the seat list, and the
indexer's input test calls with a caller the bus proved (A-179).

Builds: design 47 G lead answers A-179, A-186 (join 11 area 6)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 11:15:02 +01:00
jschoubben b83c546831 checker: compositions keeps ttl-seconds 259200 with max-mib 256; the texts say only what holds (issue 1975 note 6)
mesh/delivery merged: source.main moved to novox/mesh-delivery@983c46e2576c
mesh/delivery-group group fix/engine-reads-and-compositions merged: every member is merged
mesh/check checking b83c546831b0 on 983c46e2576c | novox/mesh-delivery#206 in group fix/engine-reads-and-compositions
Builds: issue 1975 note 6 (the lead's review round 1; no design line)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 11:00:33 +01:00
jschoubben f28c49a976 grants: a state's declared max-mib reaches its bucket, and a held bucket is raised to it (issue 1975 note 6)
Builds: issue 1975 note 6 (the lead's review round 1; no design line)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 11:00:33 +01:00
jschoubben e12f4b608f assigner: the test drives the reads-changed handler (issue 1975 note 6)
Builds: issue 1975 note 6 (the lead's review round 1; no design line)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 11:00:33 +01:00
jschoubben a3306361ee checker: the state compositions is bounded at 256 MiB and a day, and a tool drops a check's kept requests
Builds: the lead's handover of 2026-11-12 (principle 7, principle 4; no design line)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 10:48:08 +01:00
jschoubben 3ec05dda1f assigner: a reads statement older than a reads-changed heard does not stand (issue 1975)
The assigner keeps each reads-changed event it hears beside its statement (enginereads.Keeper.HeardChanged),
reads a node as the event says while its statement is behind it, and asks again until the statement is as new.

Builds: issue 1975 note 4 (the lead's handover; no design line)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 10:48:08 +01:00
jschoubben 43de6790af Join 11: the reader release's node-engine claim case names a version G reads
The case main's validator release added names `version` "1", which G's
reader refuses (MAJOR.MINOR, design 47 G §368); it names 1.0.

Builds: design 47 G §368, §508

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 10:45:09 +01:00
jschoubben a1fbd5dfa7 Join 11: the merged heads compile where no area's fix is owed
The join's importers name the delivery repository's moved contracts and sdk
(MV1), node-tools' tests use mesh-sdk's gate, the duplicate node-engine claim
rule of the reader release gives way to G's, and the assigner names its first
watched branch, never a constant. The seat holders' AnswerSeat callers are
area 6's.

Builds: design 47 G join 11 (merge of fix round 11)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 10:41:44 +01:00
jschoubben 6457cf1eba Join 11: the indexer reads a validation's answer with StepEnded.ReadOutput (B5g6 piece 2b)
The validation run's answer is read from the step's end through steprun's
ReadOutput, whole or from the build seat's output object, and the indexer
invokes seat:node-build-go.output for it (A-254); the patch B5g6 left for
the join, applied on the merged heads.

Builds: design 47 G §712, §713; lead answers A-254, A-268

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 10:37:39 +01:00
jschoubben 31662c2af9 Merge branch 'feat/47-G-fix11-b5g7' into feat/47-G-join11 2026-11-12 10:37:21 +01:00
jschoubben 66fc450ae8 Merge branch 'feat/47-G-fix11-b5g6' into feat/47-G-join11 2026-11-12 10:37:21 +01:00
jschoubben 08d38f651b Merge branch 'feat/47-G-fix11-b5j' into feat/47-G-join11
# Conflicts:
#	modules/mesh-delivery-assigner/internal/assigngraph/graph_test.go
2026-11-12 10:37:21 +01:00
jschoubben 4e67d7e99f Merge branch 'feat/47-G-fix11-b5i' into feat/47-G-join11 2026-11-12 10:37:09 +01:00
jschoubben 967b636b74 Merge branch 'feat/47-G-fix11-b4e' into feat/47-G-join11
# Conflicts:
#	modules/mesh-grants/internal/buscompose/users.go
2026-11-12 10:37:09 +01:00
jschoubben 644aa8b46c Merge branch 'feat/47-G-fix11-b4b' into feat/47-G-join11
# Conflicts:
#	modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/graphkept.go
2026-11-12 10:36:56 +01:00
jschoubben 9fae9009c5 Merge branch 'feat/47-G-fix11-b3d' into feat/47-G-join11 2026-11-12 10:36:38 +01:00
jschoubben 9433140931 Merge branch 'feat/47-G-fix11-b2k' into feat/47-G-join11
# Conflicts:
#	modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/main.go
#	modules/mesh-delivery-assigner/manifest_test.go
#	modules/mesh-delivery-assigner/module.json
2026-11-12 10:36:38 +01:00
jschoubben 4c2d8f034c Merge branch 'feat/47-G-fix11-b2l' into feat/47-G-join11
# Conflicts:
#	modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/buildended.go
#	modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/graphkept.go
#	modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/main.go
#	modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/pass.go
#	modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/tools.go
#	modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/world.go
#	modules/mesh-delivery-assigner/internal/assign/wants_test.go
#	modules/mesh-delivery-assigner/manifest_test.go
#	modules/mesh-delivery-assigner/module.json
2026-11-12 10:36:04 +01:00
jschoubben c28d12330e Merge branch 'feat/47-G-fix11-b2f' into feat/47-G-join11 2026-11-12 10:32:18 +01:00
jschoubben d89a6bacc6 Merge branch 'feat/47-G-fix11-b1g' into feat/47-G-join11
# Conflicts:
#	modules/mesh-delivery-contracts/seats/mesh-pipeline-runner/seat.json
#	modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/main.go
#	modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/steps.go
#	modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/verbs.go
#	modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/verbs_test.go
#	modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/views.go
#	modules/mesh-delivery-pipeline/internal/pipeline/start.go
#	modules/mesh-delivery-pipeline/manifest_test.go
#	modules/mesh-delivery-pipeline/module.json
2026-11-12 10:32:18 +01:00
jschoubben 5db642e161 Merge branch 'feat/47-G-fix11-b1f' into feat/47-G-join11
# Conflicts:
#	modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline-tools/main.go
#	modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline-tools/main_test.go
#	modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/findingwriter.go
#	modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/main.go
#	modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/views.go
#	modules/mesh-delivery-pipeline/go.mod
#	modules/mesh-delivery-pipeline/internal/pipeline/read_test.go
#	modules/mesh-delivery-pipeline/internal/pipeline/start.go
#	modules/mesh-delivery-pipeline/manifest_test.go
#	modules/mesh-delivery-pipeline/module.json
2026-11-12 10:30:22 +01:00
jschoubben 4aaa805f2a Merge branch 'feat/47-G-fix11-b1e' into feat/47-G-join11 2026-11-12 10:28:34 +01:00
jschoubben 2bb1b273fe Merge branch 'feat/47-G-fix11-b6b' into feat/47-G-join11 2026-11-12 10:28:34 +01:00
jschoubben 2551d13cf3 Merge branch 'feat/47-G-fix11-b7' into feat/47-G-join11
# Conflicts:
#	.gitignore
2026-11-12 10:28:26 +01:00
jschoubben 1e00430eef Merge remote-tracking branch 'origin/main' into feat/47-G-join11
# Conflicts:
#	modules/mesh-delivery-indexer/judge/rules.go
#	modules/mesh-delivery-indexer/judge/rules_test.go
2026-11-12 10:28:05 +01:00
jschoubben cfa02ea26e Join 11: refuse a committed program anywhere in the repository
A compiled program reached a commit a second time (the view's 18 MB program at
its module's root, which the command-folder pattern did not cover): the sdk's
nobinaries test refuses every tracked executable, as the catalogue's
checks/nobinaries does, and .gitignore covers a module's root.

Builds: design 47 G join (the kind's guard, fix-a-bug-met-twice)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 10:22:17 +01:00
jschoubben 88285ad5e2 B5g7-2: the indexer takes a pushed message alike with a merged one
Its head stands where a merged message's merge stands: forgeKind, pending refs, the newest load and the revision's head.

Builds: design 47 G §509, §714, A-269

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 10:18:01 +01:00
jschoubben 5355f4826a B5g7-1: the validation's job names no Go module; a Go bundle carries no package
Reverts the Go-bundle package of 53caa3ba; the run's program is the directory ./cmd/mesh-judge under the go.mod the build reads.

Builds: design 47 G §712, §676, §491, A-268

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:58:09 +01:00
jschoubben b58b3a9f6a AS5-5: the whole composition step against a stand-in node-engine and Go build seat
The assigner started whole takes the runner's composition step of a module on three machines, one away: it asks the two others'
engines for their inputs, puts one run ask per machine under its name, the stand-in build seat reads each request by mesh-wants'
input in chunks and says its step-ended with the composer's verdict, and the step's end fails naming the machine that does not
compose, warns of the one away, and keeps no input. The assigner says in its journal when it serves the step and when a machine
goes away or comes back.

Builds: design 47 G §354, §22, §63, §64, §389, A-240, A-252, A-254

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:57:26 +01:00
jschoubben 0d98108bc4 AS5-4: a running composition step says step-progress once a minute
A ticker inside the running step, stopped at its end, says the seat mesh-wants' step-progress.<node> with the ask, the asker
runner, the phase the run is in (fetch while its revision and inputs are read, run while its run asks run, report) and the time.

Builds: design 47 G §496, §603, A-262, A-267

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:54:12 +01:00
jschoubben 4f7206702f AS5-3: the composition step runs one composer request per machine as a run ask and reads its verdict from step-ended
Each machine placing the module on the step's branch is asked compose-candidate for its input; one composer.Request per machine
(depth compose, the one machine, one case change) carries it with the manifests, verdicts and seat definitions of the step's
catalog revision read through mesh-catalog's revision; the request is kept under its run ask (refused at the inputs state's
64 MiB cap, naming the store); one run ask per machine on node-build-go's check queue under the assigner's name, naming no head,
its program the node-engine build's catalog entry (the build each machine runs as its running says, read through entry, or the
revision's where it differs from the trunk's) with the composer's package. The run's end is heard on the build seat's step-ended
and its verdict read through buildstep.StepEnded.ReadOutput; a machine the watchman said away passes with a warning. The step
is served from main.

Builds: design 47 G §354, §22, §63, §64, §389, A-226, A-238, A-240, A-243, A-252, A-254, A-261

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:52:14 +01:00
jschoubben bacb663469 Merge commit 'b4eb78c2' into feat/47-G-fix11-b5g6 2026-11-12 09:50:37 +01:00
jschoubben fb62b14512 B5g6-2: the indexer validates every pending revision before its take-in
The program puts the validation's run ask on node-build-go's check queue
under its own asker and hears its end on step-ended; the manifest invokes
seat:node-build-go.accept.check. The revision validated is the branch its
merges landed on (the merged message's base, else the trunk), never the pull
request's branch. take-in.pending may name a refusal or why the revision
could not validate instead of the build it waits for. The whole case runs a
stand-in build seat: an accepted revision is taken in as before, by one ask
whose job names the indexer entry's repository, path and the revision's
head and no heads; a merge whose changed manifest gains a problem stays
pending, refused naming it.

Builds: design 47 G §712, §713, §714, A-231, A-232, A-247, A-254

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:50:37 +01:00
jschoubben 722d3a03b7 B5g6-2a: a Go bundle's entry carries the Go module its go.mod names
The validation's program is read under the Go module the indexer entry's Go
artifact names; the indexer's artifacts are bundles, which carried no
package, so every validation could not be asked.

Builds: design 47 G §676, §712, A-263

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:50:37 +01:00
jschoubben cd51fec81a B2l AS17 (4): §298's three order edges are acting waits of the assigner under order.
The new node-backup and bus module holders run before a module whose kept data's form changes moves; at a revert the node-engine goes
back last on its node; the reverted assigner and gate are wanted only once take-in.taken names the trunk's head (A-260). Kept in the
state waits, said as wait-held and wait-ended, read and released by assigner_waits and assigner_release. The manifest consumes the
indexer's take-in.taken and its version is 0.3 (A-245).

Builds: design 47 G §298, A-245, A-258, A-259, A-260
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:49:25 +01:00
jschoubben 12c213eb4c Merge commit 'b4eb78c2' into feat/47-G-fix11-b2k 2026-11-12 09:47:17 +01:00
jschoubben 9a83736411 Merge commit '5c58120d' into feat/47-G-fix11-b5g6 2026-11-12 09:44:18 +01:00
mesh-tools bf36f84445 Merge pull request 'The second reader release: the validator judges G's new forms (design 47 G §621, §697, §508)' (#205) from fix/47-G-reader-release-2 into main 2026-11-12 08:41:41 +00:00
jschoubben 5094abded9 C1c-3: the delivery SDK gives askers one reader of a run's answer from a step-ended
StepEnded.ReadOutput takes the inline `output`, else asks the seat's verb output on the node that ran the ask for the object
`output-object` names (the runtime hands the chunks as the member `file`, A-249); a step-ended with both is refused.

Builds: design 47 G A-254, A-240, A-247

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:40:36 +01:00
jschoubben 7125a9f92f C1c-2a: the step runner says a run's answer in step-ended, inline or as an object, and serves it
The puller's end of a run carries the run's program's last line of standard output as `output` up to StepEndedInlineMost, else keeps
it with KeepOutput and names the object in `output-object`; a program that exits other than 0 ends failed. OutputTool serves the
seat's verb `output` from the kept object, as the whole file the tool runner sends in chunks; OutputsStore names the store.

Builds: design 47 G A-254, A-257, §602

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:37:51 +01:00
jschoubben 63a35b8817 B5g6-1: indexer_validate_again asks a revision that could not validate again
The tool (class act) records its hand act through mesh-hand-acts first and
asks the indexer through takeins; the indexer asks the revision's validation
under its next try and answers the validation's state. A revision accepted,
refused or whose ask is out is asked nothing.

Builds: design 47 G §713

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:35:28 +01:00
jschoubben f06c9cf5fd C1c-1: the three build seats' verb output answers a run's answer in chunks
The part build-step gains the verb `output` (the ask and the call in, the ask and the chunk count out, marked chunks, read by the
askers of a run), and the fields output and output-object of step-ended name the run's answer inline or as an object the holder
keeps. The three seats' fixtures carry the verb; the generated Go and TypeScript follow.

Builds: design 47 G A-254, A-139, §712, §354

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:34:48 +01:00
jschoubben 1e48d04077 B2h AS17 (3): the pass asks about a held revert, and writes live into the want
A have held with restore point missing or damaged, for a want the
assignment graph tells a revert (Reverted) across a kept data's form
(FormChanges of the running entry and the want's, read through the catalog
seat's verb entry), gets the revert ask and the finding revert-held; backups
leaves it. Live writes the want with revert live and its words, hold writes
nothing; the finding clears once the reverted build runs, and a newer want
takes the ask and the finding away.

Builds: design 47 G §710, §300, §298; A-217

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:34:13 +01:00
jschoubben 0930d57546 AS5-2b: the composition step's machines and their inputs, asked by compose-candidate and kept
The machines of a step are the nodes whose placement names its branch (none named is the trunk; an unwatched branch takes the
trunk's nodes); each is asked compose-candidate with the step's candidate key (run-<id>, or <branch>.<revision>) and input true,
and its input is kept under the ask named for it. Not yet called by a run (AS5-3).

Builds: design 47 G §354, §22, A-226, A-243, A-252

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:33:52 +01:00
jschoubben 103174e44c FB2: the forge bridge says the finding branch-unprotected
A move of a watched branch whose protection was removed writes nothing and is said as the
finding branch-unprotected (scope merge, id the repository and branch as a key, warning) through
mesh-sdk's held finding writer into the bound state findings; a move that finds the protection
back clears it. The findings state is bound by the Binding with performed.

Builds: design 47 G §17, §131, §387, A-251
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:32:36 +01:00
jschoubben 36b893c523 AS5-2a: the assigner keeps a step's input of any size and answers the verb input in chunks
The seat mesh-wants' verb input is marked chunks (call in, chunks out); the program answers it with the sdk's SeatChunks.Send from
the state inputs and its objects store, deletes an input at the build seat's step-ended of its ask or a day after its write, and
assigner_inputs reads them. The verb is no longer a tool. Mirrors the indexer's run_inputs.go (owed to mesh-sdk).

Builds: design 47 G §354, §712, §681, A-237, A-243, A-139

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:32:03 +01:00
jschoubben 6cbaa84c52 Merge branch 'feat/47-G-fix11-c1b' into feat/47-G-fix11-c1c 2026-11-12 09:31:16 +01:00
jschoubben 86af4c29c4 AS6: assigner_delivered_again asks a version said delivered again, heard at once in delivered-again
The tool records its hand act, writes the ask {module, version, by, why} into the state
delivered-again and answers that it is asked; the process's watch of that state wakes a pass at once,
which says version-delivered again when every present machine placing the module runs that version
healthy and takes the ask away, else keeps it with why, which assigner_waits lists.

Builds: design 47 G §376, A-250

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:29:57 +01:00
jschoubben fea9de98eb AS6: assigner_release with step delivery releases a dependent's delivery wait; assigner_waits lists them
The hand act is recorded first, then the release is written on the wait in delivery-waits, which the
process ends released at its next pass, writing the dependent's want.

Builds: design 47 G §376, A-246 (G-5's row "delivery of a dependency")

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:27:59 +01:00
jschoubben b29d7b89c2 §713: a pending revision names its validation ask and resumes on its end
The take-in puts the validation's run ask and ends there; the revision's
newest pending value keeps validation {ask, asked, input, seq, try,
failed, accepted}. The build seat's step-ended of that ask resumes it:
accepted takes it in as before and is never asked again, refused keeps it
pending with refused, and an end that could not validate keeps it pending
with failed, said in take-in.pending, never a refusal and never passed.
An end of a replaced ask is dropped, written in the journal. The answer
is read from the event's own output or output object. The wiring in the
indexer's program comes with the whole-module case (IX5).

Builds: design 47 G §713, A-232, A-247, §712

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:27:52 +01:00
jschoubben 87edff67ee B5g5-1: the indexer sends the input's chunks with buscalls.SeatChunks.Send, so its Subscribe exception goes
The acknowledgement subscription is the SDK's; the indexer's inputs.go holds none, and the test that forbids a subscription in
the program no longer excepts it.

Builds: design 47 G §712, §681, A-237, A-139

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:27:01 +01:00
jschoubben 8597083493 AS6: the assigner says version-delivered and holds a dependent for its dependency's delivery
At its start it reads whole, from the first message, version-released, its own version-delivered and
the watchman's machine-away and machine-back (process.FromFirst), then hears them; it reads the
watchman's presence state no more, a machine being present unless said away. A module's newest
released version is said version-delivered once every present machine placing it on its release
branch runs healthy the want naming it, the machines away named, none when every one is away. A
dependent whose want changes fingerprint waits, by an edge of kind 2, 4 or 6, for its dependency's
newest released version on its branch not yet said delivered: wait-held step delivery, bound 60
minutes from the release, kept in the state delivery-waits, ended ran on the delivery or released
once assigner_release writes it.

Builds: design 47 G §376, §389, §498, §374, A-189, A-233, A-246

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:26:49 +01:00
jschoubben c8e1c8b40d AS5-1: the assigner takes the composition step and says its step-ended
The seat mesh-wants' accepted kind step is taken for the composition step and its end said as step-ended.<node>
under the ask's id; it is wired with its run in AS5-3.

Builds: design 47 G §22, §354

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:24:54 +01:00
jschoubben b316489b93 B2h AS17 (2b): the revert ask's words, options and its finding revert-held
RevertAsk asks hold or live, naming the reverted build, the kept data, its
form and the node's words; it expires leaving the newer build running.
RevertHeldFinding is delivery.<node>.<module>.revert-held, a warning that
needs nothing, so the ask is the operator's one message.

Builds: design 47 G §710, §300

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:24:24 +01:00
jschoubben 42c3db1d5b B2h AS17 (2a): the assigner's ask of a held revert has its kind and key
The asks state gains the kind revert, keyed revert.<node>.<module>.<hex>
after the reverted build's fingerprint; like the backup ask it needs no
proof of who answered, so the view may answer it, and an asking that ends
unanswered while the hold stands is written again.

Builds: design 47 G §710, §300

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:24:04 +01:00
jschoubben ad561e485f FB7, FB8: the forge bridge asks its findings state and finding stream in the template form
The manifest's requires gain findings (state, history 5) and finding-events (events, 7 days,
16 MiB) and its consumes mesh-conditions.findings-asked, as every part but a foundation part
declares them; the bridge gains the finding branch-unprotected (next commit).

Builds: design 47 G §387, §529, §383
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:21:51 +01:00
jschoubben b05502fa9a Merge commit '7633a2fe' into feat/47-G-fix11-b5g4 2026-11-12 09:21:45 +01:00
jschoubben ffc4b88859 A-248: buildrun.Asker puts under the asker its subject names
The indexer's validation ask rides accept.<queue>.<asker> under its own
name (§712, A-232); an asker that names none still puts under the builder's.

Builds: design 47 G A-248, A-247, §712

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:21:11 +01:00
jschoubben 2aed3151af B5g3-3: the indexer keeps an input of any size and answers input in chunks
Builds: design 47 G §712, §354, §681, A-237, A-139

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:20:34 +01:00
jschoubben c4ba9eb23e B2h AS17 (1): a want carries the operator's answer live to a held revert
The seat mesh-wants' want gains `revert`, enum live, beside `backup`; the
wants codec refuses any other answer. The assigner's state form changes, so
its manifest's version moves to 0.2 once (A-245).

Builds: design 47 G §710, §300; A-245

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:19:54 +01:00
jschoubben a600090fcd G-715: the forge bridge says a group's end once per base
ForgeGroupEnd gains base; the bridge reads each member's base from the seat's
verb groups (Member.base is already in the contract and seatgen's output),
keeps groups.<group>.<base>, says one end per base from that base's members,
and bridge_group_end_again takes the base.

Builds: design 47 G §715, A-236
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:19:46 +01:00
jschoubben 06e5980898 VW2: the view's waits are the parts' wait-held, kept in its state waits
The view's process hears wait-held and wait-ended of every part (seats and modules; waits.go, manifest consumes) and keeps them in
its state waits under owner.step.node.module (viewstate/waits.go); view_tiers reads them through the tools bundle and names each
module's waits in the sayer's own words, {owner, step, node, on, bound, since, words} (tiers.go waitsHeld), beside the indexer's
pending revisions as the seat mesh-catalog's step take-in. No state of another module is read for a tier's waits.

Builds: design 47 G §512, §376, §498, A-242
2026-11-12 09:19:18 +01:00
jschoubben 9e4ced8274 B5g3-2: the mesh-catalog seat's input verb answers in chunks
Builds: design 47 G §712, §354, §681, A-237, A-139

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:18:18 +01:00
jschoubben 2879e78481 B5g3-1: a run's input is any size, RunInputBound goes
Builds: design 47 G §712, §354, A-237

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:18:18 +01:00
jschoubben f0c4d564d2 GR16 §554: the recovery module's account is granted the bus names of kept data
The account of the module claiming the seat mesh-recovery is granted the stream snapshot and
restore subjects with their chunk subjects, a stream's deletion and a durable consumer's
creation, only for the bus names of every kept data of every manifest the part holds and of
every restore point or aside kept-points names; never a stream of the mesh's own (CONTROL,
NODES, EVENTS, DEAD_LETTER*, PROV_APPLIED, CHECKS_*, SEAT_*, a seat's KV_). The writers table
names the account as a deleter of kept data's streams (ADR 0672 §4).

Builds: design 47 G §554, §565, A-230

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:17:07 +01:00
jschoubben 9e02d6234b A-238: a run ask whose program reads only its input names no head
The indexer's validation runs its manifest validator over its input alone
(design 47 G §712: heads none); the holder lays an empty MESH_RUN_HEADS.

Builds: design 47 G §712, A-238

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:16:19 +01:00
jschoubben 316af50da3 VW3: the view's tiers are the assigner's difference of a source revision's kept revision
view_tiers compares the kept assignment revision whose catalog carries the source revision with the one kept before it,
through the seat mesh-wants' verbs revision and difference (view/difference.go, tiers.go Tiers), and reads the tiers and each
module's after (module and edge kind) from the answer; the view orders nothing. The manifest invokes the two verbs.

Builds: design 47 G §512, §186, A-242
2026-11-12 09:15:40 +01:00
jschoubben 3cc4cb9392 GR16 §565: the grants part reads the restore points' names through kept-points
The part calls seat:mesh-recovery.kept-points as a kept call at its start and again on the seat's
ended (outcome done), point-removed and expiry-ended, reads points[].names and asides[].names,
keeps them in its state memberships (kept-names.mesh-recovery) and grants the names it kept until
the call first answers; grants_first_views says the wait. A name leaves only by an answer.

Builds: design 47 G §565, §554, A-230

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:15:27 +01:00
jschoubben 1448f85b15 A-241: the validation's seats are the revision's definitions with the merges' laid over
A revision that touches no seat definition was judged against no seats at
all; it is now judged against the whole seat list, the trunk's definitions
standing in for the revision's until A-234 keeps them.

Builds: design 47 G §712, A-241, A-234

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:15:11 +01:00
jschoubben dce4d01a58 FB1, FB9, FB10: the forge bridge writes one message per move of every watched branch
The bridge watches the registrations' branches by origin (a first view of registrations, then registration-changed),
before the first registration the gate's source's (source-moved); no branch is named in its code, Trunk goes. Every
move is heard on the seat git's branch-moved through the bridge's durable on SEAT_git_branch-moved, its head read by
the seat's verb branch, never the event's: merged with its pull request and `base` (the watched branch) when the
seat's pull names the head a pull request's merge, else `pushed` with branch, head and `before`, both with the
take-in inputs at the head. The last head written per watched branch is kept in the state heads under
branch.<owner>.<name>.<escaped branch>, so a move heard twice writes once, and each watched branch's head is read at
the start and when a branch is registered. A move of an unprotected branch writes nothing. pull.merged into a watched
branch writes nothing (its message is the move's); the forge-made merge's trunk filter goes.

Builds: design 47 G §4, §7, §11, §20, §41, §507, §509, §532, §714, A-227, A-236

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:15:04 +01:00
jschoubben d5676ee4b3 AS12: the assigner keeps a run's candidate assignment graph, dropped on the run's group-ended
A run's candidate catalog-revision (meshcatalogclient's candidates hook) is read whole through the
catalog seat's revision verb; the assignment graph is computed from it in place of its branch's half
and kept apart from trunk's under candidate.<group>.<heads>, the group run-<id>. revision, entry and
difference serve it (a candidate against trunk). The runner's group-ended of the run drops it and
writes no want; the gate's heads-replaced drops nothing; its entries stay while it is kept.

Builds: design 47 G §189, §190, §186, §187, §359, A-201, A-235, A-160

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:14:45 +01:00
jschoubben ccbefc5653 B5g3-2: the mesh-catalog seat's input verb answers in chunks
Builds: design 47 G §712, §354, §681, A-237, A-139

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 09:14:28 +01:00
jschoubben c8d842b924 VW2: the assigner's difference fills Tiers and each change's after
assigngraph.Compare (verbs.go:80, new order at verbs.go:112) orders the changes by the edges of their entries: each change
names the changes it is ordered after with the edge's kind (meshwants.Change.after, seat.json, regenerated), and Tiers holds
them in that order, so the view orders nothing itself.

Builds: design 47 G §512, §186, §378, A-242
2026-11-12 06:28:02 +01:00
jschoubben b7e251a463 B5g3-1: a run's input is any size, RunInputBound goes
Builds: design 47 G §712, §354, A-237

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:27:42 +01:00
jschoubben c76d8ef381 IX5: the validation's request, run and verdict over the change and trunk cases
The running indexer's validation before take-in asks its own manifest
validator (cmd/mesh-judge under the indexer entry's Go module, at the
revision's head) over two cases and refuses only what the revision causes;
mesh-judge reads the file MESH_RUN_INPUT names, where a run writes its input.

Builds: design 47 G §712, A-213, A-232

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:24:19 +01:00
jschoubben e586c0a05c A-238: a run ask whose program reads only its input names no head
The indexer's validation runs its manifest validator over its input alone
(design 47 G §712: heads none); the holder lays an empty MESH_RUN_HEADS.

Builds: design 47 G §712, A-238

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:23:13 +01:00
jschoubben ff2f90ec18 GR13 purge: the named asks go at the first revision that leaves them, or by grants_named_purge
While no entry of the revision invokes a queue of a build seat (seat:<seat>.accept.<queue>,
read by catalogue.QueueInvoke), the part composes no named worker, and at the first such
pass it purges accept.<queue>.* of each build seat's stream and deletes the named workers,
saying each in its journal; a failed read of the catalog half purges nothing. Its account
alone is granted the stream's purge and the named workers' delete. The hand tool
grants_named_purge records its hand act first, then asks the process to do it.

Builds: design 47 G §544, §600, §601, A-231

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:22:54 +01:00
jschoubben da8384d10e VW5: the view takes each watched branch's source from the gate's verb source, per branch
The view read the gate's state source and its history, fixed to the branch main. Each watched branch's source is now
the seat mesh-delivery's verb source given that branch, asked again on its source-moved; the source row and the event
delivered are per branch, a repository's reach is from the source of its modules' registration's first branch, laid
over the reach the view's own state kept at its start, and view_tiers given no revision answers per branch. The
manifest drops its read of mesh-delivery-gate.source and names the source answer's fields it relies on.

Builds: design 47 G §507, §512, §532, §558, A-173, A-225

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:21:49 +01:00
jschoubben 019a7ab9f7 A-233 (grants): a hearer of a seat's kept event is granted the ordered consumer of its whole read
As STREAM.INFO is, for every heard SEAT_ stream whatever its keep, so a part hearing an event kept by age
reads it whole from its first message at each start (mesh-sdk process.FromFirst); no manifest word.

Builds: design 47 G A-233, A-189

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:21:30 +01:00
jschoubben 611fafb58e AM-D4: the real bus delivers no marked call to a runtime denied the marks
A deny composed into the user list must hold on the server itself: the
runtime keeps its allow of the module's tools, and neither the tool's subject
nor the caller-named subject process.Call sends on first reaches it.

Builds: design 46 7 §6 (integration, the grants part's real-bus test)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:20:21 +01:00
jschoubben 642a0ad2f9 AS14 (b, c): a requirement points first to the named seat's holder, and a contributed one carries a contribution edge
The seat whose definition delivers a requirement, among those the entry's
catalog graph revision names, is resolved first: its holder from the
placements' holds, as seat-holders keeps them; a delivering seat no
placement holds holds the entry, naming the seat. A hold now names the
requirement, the seat and each candidate {node, module}; an optional
requirement nothing provides is left absent. The catalog entry gains
contributes, filled by the indexer, and requires names every requirement
as Wants lists them, optional ones included (the module graph and the
assigner's halves leave the optional ones out by the entry's manifest).
A contributed requirement gives a contribution edge to the same provider.

Builds: design 47 G §708, §709, §357; lead answers A-167, A-229

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:19:53 +01:00
jschoubben bff7b402e7 B1g-5: the catalog's revision verb answers a candidate's group alone and a branch's source revision
Builds: design 47 G A-205, A-222
2026-11-12 06:19:07 +01:00
jschoubben 7bc4836eb0 AM-D3: a runtime whose tool runner does not honour the mark is denied every marked subject
The grants part follows the assignment half, reads each node's reading and the
runner its node-engine says running, and where the runner does not state
approval-mark/1 or the reading is not the running runner's, composes the
subscribe deny of every marked tool and verb the runtime carries, named in
grants_user_list's withheld and answered by the seat's verb withheld.

Builds: design 46 7 §6 (the deny's subjects, its cases, withheld in grants_user_list and the verb withheld), design 47 G §195, §309, lead answer A-203 (the assignment half followed by revision and assignment-revision; withheld's forms, keyed by node in the user list's state as the lead confirmed)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:17:59 +01:00
jschoubben ef28ac17f4 Merge commit '66df2aef' into feat/47-G-fix11-b1g 2026-11-12 06:17:52 +01:00
jschoubben 8e7b8ab1d1 B1g-4: an unanswered drop is said call-unanswered on its five-minute bound key's expiry
Builds: design 47 G A-222, A-77, §350
2026-11-12 06:17:05 +01:00
jschoubben dcb7ba016c FB12: the forge bridge opens its state performed by its binding
The state performed is a requires entry, so the bridge reaches it by mesh-sdk's process.Binding: the seat mesh-broker's
show asked at the start as a kept call and again on its recreated and dropped, the bucket opened by the name show
answers. Until it answers, nothing owed is performed and the bridge says it waits, naming the entry. The old name
<module>_performed goes. mesh-sdk's Binding is cherry-picked on feat/47-G-fix11-b3c from feat/47-G-fix11-a7 (fa0a107).

Builds: design 47 G §577

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:17:01 +01:00
jschoubben b925457262 B5i: the indexer fills each entry's acts and writes the kind-5 edges an acting rule gives
Builds: design 47 G §711 (and §203: the contract's step names pipeline)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:16:08 +01:00
jschoubben 121d6f24a9 Merge commit '5dec3dff' into feat/47-G-fix11-b2f 2026-11-12 06:16:03 +01:00
jschoubben cbb678f42e B1g-3: a run's rerun asks with the candidate's catalog half, not the branch's
Builds: design 47 G A-222, A-193, A-205
2026-11-12 06:15:38 +01:00
jschoubben 0cd1ab79e4 B1g-2: the runner at its start places each run's lost pipelines from its candidate's newest revision
Builds: design 47 G A-222, A-193, A-180, A-205
2026-11-12 06:15:01 +01:00
jschoubben 5a7747f2bf GR8: a seat's verb is granted to its users only where its effective callers name them
Step 4 of a module's permissions granted every user of a seat every verb the seat
serves, so a kept-artifact call was composed for any module using a build seat. The
compiled Seat now carries each verb's effective callers (seatdef EffectiveCallers, the
class defaults), filled where the askers of its queues are, and a user is granted a
verb's call subject only where those callers name it: invokers that invoke it, its
module, or a seat it holds. A seat whose definitions are unread grants its users no verb.

Builds: design 47 G §610, §336, §271 (test 60), A-165, A-179

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:12:51 +01:00
jschoubben a8314676c9 RN10 (widens): a pipeline's end names what its change widens, from the catalog's revisions and the grants part
The candidate (the pipeline's own revision) against the branch's newest through mesh-catalog's revision; serving parts by the holder of the runner's, catalog's, steps' and composer's seats; acting rules, credentials; grants through grants-for. A read that fails says could not run. Touches steps.go (Hearer.Widens field, say's pipeline-ended), main.go (hearer.Widens), module.json invokes.

Builds: design 47 G §71, §275, §335, §441, A-207, A-215, A-220

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:11:47 +01:00
jschoubben 248d09ec14 Merge feat/47-G-fix11-b4c (GR12: the grants part claims mesh-grants and serves grants-for) into feat/47-G-fix11-b4b 2026-11-12 06:11:34 +01:00
jschoubben d9dcb3ef36 Teller answers: the assigner follows the teller's views.answers, never its bucket
The assigner's read of mesh-delivery-teller_answers goes: its process reader
follows the teller's answers by their first view (teller_read_answers) and the
views family views.answers, and the pass watches that picture as it watched the
bucket, without gating the first pass on it.

Builds: design 47 G A-175, A-178

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:10:47 +01:00
jschoubben 5125feabe6 AM-D3 path: the assignment half carries each node's readings with the runner's fingerprint
The grants part reads a node's capability readings and the runner that
announced them from the assignment half; the assigner reads both from the
node record it already holds, the digest over all of it.

Builds: design 46 7 §6 (the assignment half carries, for each node, its capability readings, each with the fingerprint of the runner that announced it), design 47 G §194, lead answer A-203 (readings, fingerprint)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:08:16 +01:00
jschoubben 50f3dde9f5 RN17 (show/kept fill): show and kept carry each store's fill, read through the bundle's calls
Builds: design 47 G §366, §623, A-214

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:07:59 +01:00
jschoubben 298f26bb4c Merge commit '68c87cc3' into feat/47-G-fix11-b2c 2026-11-12 06:07:49 +01:00
jschoubben d9a9da921a RN12: the runner runs on request, its pipelines placed from the run's candidate revision
run writes each member's pipeline at once under the run's random id and its named branch and says
run-started; the candidate run-<id>'s catalog-revision, handed to the runner by meshcatalogclient's
candidates hook, is read whole through the revision verb and places each member's steps and a pipeline
of each entry the members change, saying pipeline-started once each.

Builds: design 47 G §64, §373, §420, A-160, A-180, A-185, A-193, A-199

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:07:38 +01:00
jschoubben 12e1fd4403 AS17 (a, b): a revert is a want going back to an earlier fingerprint by the assignment revisions' numbers; a kept data's form change is read from the entries' manifests
Builds: design 47 G §298, §300, §303, §213; lead answer A-217

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:07:19 +01:00
jschoubben 2e9bd2bd7b Merge branch 'feat/47-G-fix11-b3b' into feat/47-G-fix11-b2c
# Conflicts:
#	modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/main.go
#	modules/mesh-delivery-assigner/manifest_test.go
2026-11-12 06:06:43 +01:00
jschoubben a5cafab0e8 AS20 (§558): the assigner's invokes name the fields it relies on of the catalog seat's revision
Builds: design 47 G §558, §530

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:06:42 +01:00
jschoubben 9fed8edb50 A-206: the held wait's clock is the build.ended of the awaited runner, heard from the builder's stream
The runner hears the builder's stream of build ends (kept last per subject, read whole at its start, A-181: consumes
`mesh-delivery-builder.build.ended.**`) and keeps when each build ended, the stream's own time. wait-held carries it as
`clock-from`, the bound of the wait is armed from it (30 minutes less what passed), and a bound whose build has not ended is armed
when its end is heard, with wait-held said again. A failed end starts no clock.

Builds: design 47 G §266, §269, §703, A-181, A-206

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:05:29 +01:00
jschoubben eb45c3c67c GR14: the keeper hears either finding stream form, each module publishing its own node's
A * emitter before a finding event reaches the stream a part asked for by the
template events (its finding-events) beside the old stream; a part's finding
stream is published on its own node's subjects alone.

Builds: design 47 G §386, §529, §515

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:05:07 +01:00
jschoubben 84db958110 AS13 (§181): the assignment graph store says filling, full and room; a full store keeps the last revision and writes no new want
Builds: design 47 G §181, §579

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:04:49 +01:00
jschoubben 00cc0f8ff2 IX4: the indexer names the trunk main once
trunkLike takes TrunkBranch where it named the string again, so the first watched branch changes in one place.

Builds: design 47 G §7, A-93

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:04:27 +01:00
jschoubben d3e555e2f4 A-204: the assigner keeps the put waits it said in its state put-waits
A put that ends while the assigner is stopped now gets its wait-ended at the
next start: the said waits are read from the bus, not seeded from the puts
that wait now.

Builds: design 47 G §498, A-204, A-211

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:03:58 +01:00
jschoubben bbd872f519 AS21: the assigner follows the watched branches the gate's source and the registrations name, reads no gate bucket and names no branch
The assigner follows the catalog half through meshcatalogclient's branch follower (the registrations' branches, before the first
registrations those of the gate's verb `source` and its event `source-moved`, §507, §532): its trunk is the first watched branch,
never a fixed "main" (§7). It reads neither the gate's `source` nor `merges` (§431); the Approve of a release is no yes to a move
(the release lookup goes). The follower tells a part of each branch it adopts (Branches.Adopted).

Builds: design 47 G §507, §532, §431, §7

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:03:49 +01:00
jschoubben 2940df27b1 VW5: the view follows the catalog half per watched branch through meshcatalogclient's branch follower
The process and the tools bundle read the catalog half through Branches
(FollowBranchesProcess, FollowBranches) and Branches.Entry instead of one
view of a branch named in code; the module's value carries the entry's
manifest-digest bare and computes none. The manifest consumes
registration-changed and source-moved and invokes registrations, and
revision, entry and source in the long form with the fields relied on.
The built binary committed at the module's root goes.

Builds: design 47 G §532, §614, §558, §506, §578, A-103

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:03:48 +01:00
jschoubben 144f05a099 IX8: a module built on a package that calls the tool runner is ordered after the artifact that states the words
For each package a module's entry builds against whose artifact takes `calls`, an edge of kind 6 names each word and runs
from the artifact whose manifest entry `states` it, so no manifest names the tool runner's module.

Builds: design 47 G §605, §545 (A-208)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:03:48 +01:00
jschoubben 0892f112bc IX8: a kind-6 edge names the fields a long-form invoke relies on
The entry's manifest is read by the second reader release (RR2-4), and an invoked verb given as {verb, fields} puts the
fields in its edge's `why`.

Builds: design 47 G §558 (A-208)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:03:20 +01:00
jschoubben 03ee0930e1 RN17 (unlogged): a step's end and its log entry are one write, appended after the end is said
The pipeline gains `unlogged`: a step's end is written in its key with its step-log entry in one compare-and-set, said as
step-ended, then appended to the step log and cleared; a log that refuses an append ends no step, says full and starts no new
pipeline; at its start the runner appends every unlogged entry in order after reading back the log's last entry of that
pipeline, and once a minute while the log is full. The tools runner_unlogged and runner_unlogged_append (a hand act).

Builds: design 47 G §486, §606, §549
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:03:08 +01:00
jschoubben ca4aa88583 IX8: the indexer writes each entry's edges of kinds 1, 2, 3, 4 and 6 into the revision it keeps
An entry's edges run between artifact references, from the artifact that comes first: kind 1 from the publisher of a
package it builds against, 2 from an artifact its `needs` names, 3 from its build module and its bases, 4 from the
provider of a provision a want of it waits for, 6 from the server of a verb it invokes (none on a cycle). Kind 5 waits
on a design line (A-212).

Builds: design 47 G §47, §48, §49, §50, §121, §122, §378, §432 (A-208, A-212)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:02:58 +01:00
jschoubben a4fcf3de51 GR12: the seat mesh-grants claims its seat and serves grants-for
The part claims mesh-grants, serving grants-for: a run by its group run-<id> or a
source revision by the branch and the new optional source of mesh-catalog's
revision (contract regenerated), compared with the branch's newest by the
permissions the composed accounts gain and lose with the candidate's entries in.

Builds: design 47 G §401, §441, §449, A-205

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:02:44 +01:00
jschoubben 9fd2066711 A-206: the wait's on gains the value runner version
A pipeline held for the runner's new version says its wait-held and wait-ended on `runner version`, no longer on `build node`.
Contract (seat.json, regenerated by seatgen) gains the value.

Builds: design 47 G §534, §696, A-206

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:02:35 +01:00
jschoubben de06949121 AS10: the assignment graph finds a cycle among the waits within one step and says it
Builds: design 47 G §272, §356

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:02:18 +01:00
jschoubben d44c45c9b9 A-206: the bound's expiry writes the finding pipeline-waits through the runner's finding writer
ReleaseExpired says each pipeline it started through the starter's Late, and the process writes the finding pipeline-waits
(scope module, id the pipeline's key `<branch>.<id>.<module>`) naming the awaited runner and since when.

Builds: design 47 G §266, §269, A-206

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:02:16 +01:00
jschoubben 56c45eb7d6 RN8: a newer commit or publish supersedes the older running pipeline, its asks dropped where they stand
A step keeps the node whose holder said ask-taken; a superseded step's drop is asked of that node's holder, an
untaken ask's of any holder, as kept calls; steps on mesh-builds and mesh-wants are only ended superseded. A
pipeline a publish started says that publish (published), so a newer publish of the package supersedes it.

Builds: design 47 G §31, §119, §350, A-182, A-202

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:01:44 +01:00
jschoubben 6ce46884d5 AS9: an entry waits for its acting part's new version in composing and placing; assigner_waits lists the wait, assigner_release now lets it go
Builds: design 47 G §266, §268, §276, §269 (the assigner's part: wait-held with bound and clock-from, wait-ended; acting-part-late is the watchman's)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:01:38 +01:00
jschoubben 6635dda18f A-206: the seat verb release and the tool runner_release start the held pipelines by hand
The seat mesh-pipeline-runner gains the act verb `release` (why; answers how many it started) beside start and ask-again, its
hand act written first through mesh-hand-acts; each released wait ends `released` and its bound is dropped. The tool
runner_release asks the verb. Contract regenerated with seatgen.

Builds: design 47 G §276, §534, A-206 (A-195)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:01:22 +01:00
jschoubben e163aab3d1 AM-D3 deny: a user's subscribe deny is written, compared and kept
The grants part composes a subscribe deny where a node's tool runner does not
honour the approval mark; the user list must carry it to the bus, and an added
deny is a narrowing the user-list guard lets pass as no right lost.

Builds: design 46 7 §6 (Permissions.SubscribeDeny, User subscribe_deny, comparison and differences, the guard's narrowing)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:01:01 +01:00
jschoubben 2a46134d14 RN22: a recovery's steps are asked on the build seats' stream delivery
The runner keeps each commit the seat mesh-delivery says a recovery merged in its state recoveries; a pipeline whose commit is
named there has its go, node and image steps asked on delivery.step, ahead of the first round, at its start, its resume and a
rerun; a recovery heard after its pipeline started asks nothing again.

Builds: design 47 G §81, §86, §415, A-207
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 06:00:36 +01:00
jschoubben 41ecd473da GR5: a module's sent store is read by the callers and consumers it is for
Derived at every pass from the catalog graph's manifests and the seat definitions'
callers, never from a manifest field.

Builds: design 47 G §59, §124, §442

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:59:54 +01:00
jschoubben 3eb07835f7 GR6: a state's <state>-objects store is granted to the state's owner alone
Builds: design 47 G §58, §91

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:59:50 +01:00
jschoubben edc8bbd9ab §7, §428 (watchman): a bus user is said by its module's name, the tool runner's no differently
signals.go BusUserWords: the node-tools special word is gone (the node-engine's node.<node> user stays, a bus account form, not a
module name). The watchman's ControlNodeModule (signals.go:591, nats) and builderModule (names.go:17) went with A-197 and WM13.

Builds: design 47 G §7, §428

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:59:49 +01:00
jschoubben e0b4f73c9e RN17 (fill): the runner says its stores' fill and a full store refuses a start
The seat gains the events filling, full and room; at each step's end and each start the runner reads the fill of pipelines,
step-outputs, kept and step-log against their caps, says filling past 80 %, full at the cap and room below 70 %, and a start
while a store is full is refused, said in the journal and heard again by the bus.

Builds: design 47 G §366, §181
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:59:18 +01:00
jschoubben 3eca094c5c A-197: the watchman reads no node-engine state: have and health go, running ends a want's pulse
Removed with the reads of node-engine.have and mesh-host.health: the findings module-unhealthy (module <module>.<node>, token
unhealthy, urgent after four hours), kept-as-it-runs (module <module>.<node>, token kept), apply-failing from a have that failed
(machine <node>; the provisioner clients' half stays), machine-network, network-rewritten, network-unreachable, machine-units,
relogin-needed, directory-used-as-found, node-account-fallback, and the urgency of a silent control node. A want's pulse now ends on
the node-engine's running event (consumes node-engine.running).

Builds: design 47 G A-197, A-192, §541

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:58:55 +01:00
jschoubben 6182730923 GR2: grants_callers and grants_why_refused
The first reads the callers each verb and accepted kind of the seat definitions
admits, the second says which call subject an account lacks (the bus's own
nats_user_can) beside the definition's callers.

Builds: design 47 G §83, §391, §395

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:58:25 +01:00
jschoubben c2950e332f A-194: indexer_runs reads the state runs and the run candidates, indexer_run_drop drops one by hand
The drop is a hand act recorded through mesh-hand-acts before it is asked; the indexer, the state's owner, drops the
run's candidate and its key.

Builds: design 47 G §64; A-194

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:57:11 +01:00
jschoubben e053605e82 RN19, RN21: the pipelines of a change to the runner are held until its new version runs healthy
The seat's pipeline record gains `held` (since, the fingerprint awaited). A take-in giving the runner's own module a new
fingerprint holds every pipeline it starts, and a later take-in's while any is held; wait-held (step pipeline) is said, the
30-minute bound is a key of the state bounds. The node-engine seat's running of the runner's module at the awaited
fingerprint, healthy, or the bound's expiry, releases them: steps placed and asked, wait-ended and pipeline-started said. A
runner starting at the awaited fingerprint releases at its start. runner_waits lists the held pipelines.

Builds: design 47 G §65, §266, §276, §534, §19 (lead answer A-195)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:57:05 +01:00
jschoubben d68e6b877d RN16: the runner ages its own kept data by its own deletes, in the step log's order
Three step-log sequences in the state aged, one per retention (7, 30, 90 days); at each step's end up to 20 entries per
sequence past their retention delete the output and the pipeline (7 days), a kept result not read for 30 days (30 days) and a
passed pipeline (90 days), never a pipeline that is its branch's newest; each delete is a journal line. The step log is
written to and read from the log's stream (design 47 G §470); a log entry names the kept results it wrote or carried and a
kept result its last read.

Builds: design 47 G §330, §410, §470
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:56:54 +01:00
jschoubben 161d6e6451 WM16: a record is covered only by what is late for the entries of its own revision
record-opened is joined to the take-in.taken of its milestone, <branch>.<source revision>, whose entries name the modules; the
record-open finding is left unwritten only while one of those modules is held by an acting-part-late wait (or a store says full),
no longer while any wait is late. A record whose revision is not known taken is covered by a standing take-in-waits.

Builds: design 47 G §502, A-200

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:56:33 +01:00
jschoubben f8bae4bee8 GR13: a build seat's queues take named asks beside main's, each asker granted its own
Each queue gets a named worker filtered to accept.<queue>.*; an asker is granted
accept.<queue>.<its seat> for the queues of the kinds it is a caller of, read from
the definitions' callers lists; main's accept.<queue> is the checker's and the
builder's alone. The purge of named subjects and workers (grants_named_purge) is
not in this commit.

Builds: design 47 G §543, §544, §600, §601, A-163, A-170, A-184

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:56:06 +01:00
jschoubben 0c6c5d20d6 Merge feat/47-G-fix11-b5a into feat/47-G-fix11-b5d
# Conflicts:
#	modules/mesh-delivery-indexer/internal/index/pending_test.go
#	modules/mesh-delivery-indexer/internal/index/takein.go
#	modules/mesh-delivery-indexer/manifest_test.go
#	modules/mesh-delivery-indexer/module.json
2026-11-12 05:55:24 +01:00
jschoubben 1abc5ae6d9 WM9, WM15: the manifest findings are the indexer's verdicts heard as events
manifest-refused raises manifest-refused; manifest-accepted, which carries problems, raises manifest-outgrown or clears it
and any refusal; the start seeds both from indexer_verdicts. The indexer's modules view (ModuleVerdict, views.modules,
indexer_read_modules) is no longer followed, and manifest-waits is no longer written (§500).

Builds: design 47 G §500, §196, §668

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:55:02 +01:00
jschoubben f86ccc378c AS14 (a): an assignment entry held for want of a provider names the candidates
A requirement neither bound nor pinned points to the provider on the
consumer's node, else the only provider; otherwise the entry carries the
new field held (seat mesh-wants' AssignmentEntry, generated by seatgen),
naming each placed provider as a candidate, and nothing is guessed. The
named seat's holder and the contribution edge wait for their design line.

Builds: design 47 G §357; lead answer A-167

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:54:38 +01:00
jschoubben 5b13cc7ab1 IX24: the indexer's four kept calls are asked again only while their ask is open
messageVia, stepsVia, sourceVia and versionsVia go through CallKeptWhileOpen: open while the commit's take-in
is pending, the candidate is held, the branch is watched, the module is in the newest view. A call that ends
with its ask closed is index.ErrAskClosed, not an unanswered call.

Builds: design 47 G §351, §367, §460, §531; A-190

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:53:45 +01:00
jschoubben faec6b5333 WM13 (watchman half): the builder's builds are no longer read; a package wait is heard as wait-held
The watchman's read of mesh-delivery-builder.builds (Build in mirror.go, the bucket, its manifest reads) goes; it hears the
builder's wait-held and wait-ended on the builder's stream, naming a package as their part, and times them as an acting
part's wait. A toolchain wait (no part) is left to the builder's own finding. The node-engine's have and mesh-host.health
reads stay: no event carries a have's phase, kept data, node record or a node's health report (asked of the lead).

Builds: design 47 G A-192, §484, §496, §602, §548

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:53:23 +01:00
jschoubben 267bd0a9cb RN11: the runner says a failed head as the finding pipeline-failed
A required step that failed or could not run writes the finding of its commit, owned by the commit's author as the forge
records it (read through the seat git's pull); one with no known author has no owner and says why, written at the next step
end of that commit; a newer revision passing the steps clears it. The runner's finding writer is the held writer.

Builds: design 47 G §33, §540, A-191
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:53:20 +01:00
jschoubben 6676b42dab RN5: an empty approval status is no step and asks the operator nothing
Builds: design 47 G §553, §23, §26 (lead answer A-196)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:53:07 +01:00
jschoubben 9cd38f59ff A-181: the assigner reads the builder's build ends from their stream, kept last per subject, and reads no builder bucket
The builder's `build.ended` stream declares last-per-subject; the grants part composes it one message per subject and its readers read
whole; the assigner reads it whole at its start then follows it (consumes `build.ended.**`), so what was built and a failed build's error
survive its restart. world.built, buildNeeds, manifestOf and the put verbs read the ends; the manifest reads no builder bucket;
assigner_put's fingerprint-prefix form goes.

Builds: design 47 G A-181, A-162, §556, §703

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:53:02 +01:00
jschoubben 0f4a33ce48 TL5: the teller carries the assigner's asks only, follows the view's answers and says its own on views.answers
The merge-ask path goes whole with the Approve per merge: the reads of
mesh-delivery-gate.asks and mesh-delivery-view.answers, OnAsk, OnAskGone, the
gate branches of Answer and the room list, and the merge words. The teller
follows the view's answers through view_read_answers and views.answers, says
its state answers as views.answers from its state teller-marks, and serves the
read tool teller_read_answers. The room list stays for the assigner's asks
(the lead's answer). viewstate gains the names the view's own commit gives it
(the same hunk, so the two merge cleanly).

Builds: design 47 G §653, §431, §512; lead answers A-172, A-175, A-178

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:52:42 +01:00
jschoubben 524fbb02ef WM13 (builder half): a key queued behind a package says wait-held and wait-ended in the one wait form
The builder says wait-held for a key queued behind a package, the package as its part and on (package:<ref>), on its
stream waits, and wait-ended published once the key is claimed; a toolchain wait never ends by that, and a package wait
never by a toolchain's end. Files: internal/build/waits.go (Package, On, WaitPublished), internal/build/run.go (Hold at
the queued result, End at the claim), cmd/mesh-delivery-builder/waits.go (Part in the body, the End rule).

Builds: design 47 G A-192, §499

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:52:10 +01:00
jschoubben e5c864c246 RN9: pipeline-ended carries test counts and over-budget; group-ended says a group's end
pipeline-ended carries the module's test counts (the sum of its steps') and over-budget
past 500 unit or 50 integration tests; once every member of a group on a watched branch's
source revision ended, group-ended is said under the group.

Builds: design 47 G §24, §73, §332, §419

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:51:33 +01:00
jschoubben 00c888546a §498: the assigner says a put without hold as a wait, and assigner_puts answers since and bound
A put without hold whose want is written is said as wait-held on the seat
mesh-wants (step put, node, module, fingerprint, since, bound 30 minutes)
and wait-ended when it runs, is released or is put again, so the watchman
times it; a held put is no wait.

Builds: design 47 G §498; main file *A put without hold that stands*

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:51:26 +01:00
jschoubben 8953adad88 RN5: a step whose status a policy leaves empty is optional and runs
A step neither the artifact's nor the module's policy names is placed as an optional step
(Status returns optional), no longer no step; a failure of it holds nothing.

Builds: design 47 G §553, §23, §32, §535

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:50:24 +01:00
jschoubben 0772e6dc23 IX14: a run on request's candidate from the runner's run-started, dropped once every member's pipeline ended
The indexer hears the runner's run-started and pipeline-ended on their own streams and writes candidates.run-<id>:
one pull per member, its repository and directory from its registration, its manifest and fingerprint from a take-in
of its commit read through the seat git, over its branch's revision view when its registration watches the branch,
else the trunk's. The state runs keeps each run's members and ended modules, so a restart between two ends still
drops the candidate. The try candidates, the checker's checks consumer, checker_tries and the three try tools go;
IsTryGroup takes run-<id> beside try-<digits>.

Builds: design 47 G §64, §190, §321, §66, A-160, A-174
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:50:15 +01:00
jschoubben 0fba15e32c VW5: the view says its answers on its views family
The teller follows the view's answers by view_read_answers and
views.answers instead of reading the view's state; the view emits from
its marks state view-marks, as the other owners do.

Builds: design 47 G §431; lead answers A-175, A-178

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:49:52 +01:00
jschoubben 62de8d0bb8 WM4, WM5: the watchman hears the node-engine's wait-held and wait-ended
A hold of the composition standing past 30 minutes is delivery-waits (node, module, reason), a wait for a kept build
past 60 minutes is kept-build-waits; each clears on wait-ended. The node-engine's version is not yet named in them
(it needs the catalog entry of the fingerprint running.<node>.<node-engine's module> names).

Builds: design 47 G §499, §541, §271, §376

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:49:48 +01:00
jschoubben f3c35722d9 AM-D2: the grants part's own copy of the wire pattern goes
A reader turns a stream's events into the bus's subjects with mesh-sdk's
buscompose.WirePattern; the grants part's copy goes. The catalog graph
entry already carries the validated manifest whole, its needs-approval,
emits and streams with their grant among it (design 47 G §443).

Builds: design 46 7-approval-mark §5

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:48:49 +01:00
jschoubben 464206d2de WM1 (step half): a head behind a pending revision of its branch raises no pipeline-stands
The watchman keeps the watched branch each open take-in wait names (take-in.pending's branch) and times a head only
while its branch has none; once the revision is taken in the head is timed again from its own move. The head on a
branch whose branch-unprotected stands (§497's second sentence) is not built: nothing the watchman hears says it
(the forge bridge writes that finding, no event).

Builds: design 47 G §12, §75, §497

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:48:30 +01:00
jschoubben 3c38f9c468 IX31: the whole test judges the indexer's manifest against a seat list holding the assigner seat's view
The indexer consumes the seat mesh-module-assigner's views.assignments in the seat's form, which the validator accepts only
where the seat list holds the seat and offers the state as a view; TestIndexerWhole seeds that definition.

Builds: design 47 G §616, §699, A-119, A-131
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:48:20 +01:00
jschoubben 58e4a737d5 AM-D5: a per-machine state reaches its machine's keys below it
A per-machine state's account reaches its machine's key and the keys
below it (mesh-sdk PerMachineKeys), no other machine's, so the tool
runner's approvals keep <node>.ask.<id> and <node>.act.<digest>; the
membership names the machine's key in the same form.

Builds: design 46 7-approval-mark §13

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:48:17 +01:00
jschoubben 5788fbb5d6 VW5: the view reads neither the gate's asks nor the teller's answers
The Approve per merge goes with G, so the gate's merge asks are no asks of
the view's; the teller's answers are followed by their views family
(teller_read_answers, then views.answers), never read from its state.

Builds: design 47 G §512, §431; lead answers A-172, A-175

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:46:41 +01:00
jschoubben 558a93c25b AM-D1: the validator refuses a mark nothing enforces
A manifest marking a tool its tools do not list, a verb its claims do not
serve or an event it does not carry, one name both a tool and an event, a
marked tool or verb (or a held seat verb its seat marks) without
operator-channel in uses, or a marked tool or verb while every bundle it
builds is run by its own process, is refused by both paths, naming the
entry and the rule. The login shell's captured manifest is copied at
AM-K1, which gives it operator-channel.

Builds: design 46 7-approval-mark §4, §7, §21; design 34 every-event §32; lead answers A-177, A-183

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:46:16 +01:00
jschoubben b90e767529 IX17, IX18: the indexer keeps the records pinning each catalog graph revision and removes a revision only on an event
State pins (4 MiB; one key per revision <branch>.<revision>, made, pins-stated) applied from a durable consumer of mesh-delivery's
pinned, freed, heads-replaced and pins-stated, acknowledged after the apply; a revision is removed when no record pins it and it
is not current, only while the consumer has nothing pending and after a pins-stated later than made; finding pin-missing; tools
indexer_pins, indexer_unpin, indexer_consumer (the state consumers, written by mesh-sdk's process.ConsumerLedger).

Builds: design 47 G §153, §178, §189, §215, §216, §579, A-169, A-171, A-176
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:45:50 +01:00
jschoubben 7033d5e80d BG2, BG3: the puller refuses a kind its asker may not ask and pulls the named worker
An ask's asker is the last token of its accept subject; the holder checks the kind against the callers the build seat's
definition lists (Puller.Callers, CallersFromDefinitions), refuses an ask of another kind answering error naming the kind
and the asker and ending it failed, takes only a build and a run on main's subject, and gives back an ask the seat list
does not judge yet. A second worker per queue (AskNamedWorker, filtered to accept.<queue>.*) is pulled after main's; the
holder says `named worker not bound` while its membership lists none.

Builds: design 47 G §543, §544, §481, A-163, A-170

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:44:38 +01:00
jschoubben 8f43d0ecdf AS23: build.ended says a failed end too; a hold under rule 1 says how the build stands
The builder's build.ended is said for a failed build as well (outcome, error whole);
the assigner's rule-1 hold reads "the build of M at F failed: <error>" from it and
"is being built" while none is heard. The assigner's reads of the builder's builds
bucket stay (see the report: a restarted assigner holds no ends heard).

Builds: design 47 G §575, §568, A-162 (survey AS23)
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:43:15 +01:00
jschoubben d6c1e27259 Merge branch 'feat/47-G-fix11-b5b' into feat/47-G-fix11-b7 2026-11-12 05:43:07 +01:00
jschoubben 4b47e88369 RN25: runner_health reads the consumer facts mesh-sdk's ledger writes
The runner's own writer of its consumer's oldest unacknowledged delivery is
replaced by mesh-sdk's consumer ledger: each message the hub hands a handler is
noted delivered, and applied when the handler acknowledges or ends it; one it
asks again stays unacknowledged. The key form is the same, a key per consumer
by its name in the state consumers. A runner that heard no event yet is healthy.

Builds: design 47 G §76, §468, §495; lead answers A-166, A-176

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:42:33 +01:00
jschoubben cbfea2f961 AS22: the assigner reads a build's health from the node-engine's running alone
Rules 3, 4 and 5 (canary, healthy elsewhere, a hold's lift) and the outside-cause
judge read `running.healthy` (a running with none reads healthy, nothing heard
reads not healthy); no fallback to the have. Phase and failed-health reads of the
have stay where `running` says nothing of them.

Builds: design 47 G §520, §556 (survey AS22)
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:42:25 +01:00
jschoubben 0178fc86a8 AS13: the assigner keeps the pins of its assignment graph revisions
A delivery record's pinned and freed reach the assigner on its durable
consumer, kept per revision in its old state pins by compare-and-set
before the event is acknowledged; a revision neither pinned nor current
is removed only while the consumer is caught up and after a pins-stated
said since the state was made, never on a timer and never by reading
the gate's state. assigner_pins reads it, assigner_unpin frees a lost
freed by hand, recorded in the hand-act log first.

Builds: design 47 G §153, §178, §179, §216, §579; A-169
Left of AS13: §181's filling, full and room.

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:41:40 +01:00
jschoubben 459c03933c TL1: the teller's integration bed grants and creates the state widens-said
Builds: design 47 G §335
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:41:38 +01:00
jschoubben 9199bb20f4 RN14: the runner serves start and ask-again
start starts by hand the pipeline of a watched branch's head from the runner's
catalog half, refusing a head already started; ask-again asks a declined
approval once more under an ask of its own, its id following from when it was
asked again so the ask rebuilt for its warrant is the same. Each is recorded in
the hand-act log first; the process answers both beside review, rerun, accept
and cancel.

Builds: design 47 G §30, §39, §306, §36, §394

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:41:03 +01:00
jschoubben 893f425c56 WM14: a put without hold that stands is the finding put-stands
A wait held with step put (no part) raises put-stands once its bound has run from its clock, and wait-ended ends it; a pipeline's
wait raises nothing for it. The seed from assigner_puts waits on that tool answering since and bound (assigner's, not built here).

Builds: design 47 G §498
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:39:03 +01:00
jschoubben 7ce80ce590 EE-D4: the validator has no rule about the waits list
The manifest no longer carries what a session waits on (mesh-sdk EE-S2), so
the rule judging it and its token form go; a manifest still carrying waits
is a field the validator does not know, refused by Shelf and set aside by
ShelfWaiting, and the tool runner's manifest without it is accepted.

Builds: design 34 every-event §10

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:38:52 +01:00
jschoubben 05b0385805 WM8: watchman_views answers the condition keeper's view-waits by part, node and view
Builds: design 47 G §83, §501, §609
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:38:23 +01:00
jschoubben cce99f2802 IX17: the pinned event's catalog entries name their branch
Pins.catalog is a list of {branch, revision} in the mesh-delivery seat's definition (revisions are numbered per watched branch),
the Go and TypeScript contracts regenerated, the fixtures follow.

Builds: design 47 G §579, A-169, A-171
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:38:16 +01:00
jschoubben 8f09aa223b RN25: the runner's health check is its tool runner_health
The process writes, in its state consumers, when its durable consumer's oldest
unacknowledged message was delivered, at each delivery and acknowledgement; the
bundle's runner_health reads it and the pipelines state, and names a consumer
five minutes or more behind. The process resource's health is that tool.

Builds: design 47 G §76, §468, §495; lead answers A-164, A-166

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:37:55 +01:00
jschoubben f913d85e66 EE-D3: the real bus holds the tool runner's hearing of every event
The grants part's real-bus test gains a case: the tool runner's composed
account hears a module's event, a module stream's and a restricted
stream's whose grant names no tool runner, still after that grant changes
and the accounts are composed again; it publishes none, hears no accept
or proof, and gets no consumer or acknowledgement on the restricted stream.

Builds: design 34 every-event §9, §27

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:37:08 +01:00
jschoubben 7ba95ac07f TL2, TL3: the teller tells a recovery and a merge made at the forge on every channel
recovery-merged gains module and branch, and a forge-made record-opened gains repository, pull, commit and branch (seat
definition, generated Go and TypeScript, fixtures); the teller hears both events and tells them through operator-channel's notify
with every-channel, in the operator's words of §522.

Builds: design 47 G §81, §82, §170, §514, §522 (lead answer A-161)
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:36:47 +01:00
jschoubben 820f7c2351 IX31: the indexer follows the seat mesh-module-assigner's assignments through its holder, no assigner module named
The holder is asked through mesh-sdk's seatlist.HolderOf, its first view and views family followed as the builder's and the
checker's are; the module consumes the seat's views.assignments and invokes the seat's verb assignments alone.

Builds: design 47 G §7, §428, §556, A-119, A-126, A-131
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:35:57 +01:00
jschoubben a489c738b3 TL1: the teller tells a pipeline's widening on every channel, once per commit
The teller hears pipeline-ended, tells each end that carries widens through the seat operator-channel's notify with every-channel,
one line per entry, and keeps the last commit said per module and watched branch in its state widens-said (read by
teller_widens_said); registration-changed drops the branches no longer watched.

Builds: design 47 G §71, §335, §514, §522
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:34:43 +01:00
jschoubben fc4ce1cd79 RN25: the runner's stores declare their caps, its sent store, tools named runner_
The pipelines state is capped at 256 MiB and kept at 128 MiB in the old state
section, the sent store sent-objects is declared at 256 MiB, and the first-view
tools carry the runner's tool prefix.

Builds: design 47 G §469, §85, §477, §533, §539

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:34:01 +01:00
jschoubben 00b52e3c1f BG4, BN4, BI4: the puller says ask-taken, step-progress and the end of any ask
A holder says ask-taken when an ask starts, step-progress every minute while it runs (phase fetch, build or run) and
step-ended for an ask outside a pipeline, each on the seat's subject of its node (SayOn); the asker is the last token of
the subject the ask came on (Pulled.Subject).

Builds: design 47 G §496, §602, §603, §481

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:33:26 +01:00
jschoubben 69a0004fe6 EE-D2: the tool runner's runtime hears every event subject
Where the runtime's permissions are composed, a runtime carrying the tool
runner subscribes mesh-sdk's EveryEvent (every seat's, module's and module
stream's events) and nothing else for it, replacing the per-family list.

Builds: design 34 every-event §6, §8, §25, §27

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:32:04 +01:00
jschoubben 9a28de8ab0 CK9: the checker follows the seat list through mesh-sdk's seatlist.Part, its own seatlist.go goes
Builds: design 47 G §204, §264, §320

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:30:45 +01:00
jschoubben 54a9159b25 EE-D1: the grants part computes nothing from the waits list
The tool runner's manifest no longer names the event families it may wait
on (mesh-sdk EE-S2), so the grants part's copy of that list goes whole:
its subjects, its membership field and its record reading.

Builds: design 34 every-event §5, §7

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:30:36 +01:00
jschoubben b4155cc5a2 gofmt: the six files the delivery review named, and three import blocks
The assigner's asks.go, tools.go, seat_tools_test.go and assign/wants.go,
the builder's builds.go and the indexer's candidate_values.go, and the
import blocks of three tests the step runner's move reordered.

Builds: delivery review round 1, the gofmt finding

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:21:48 +01:00
jschoubben e6ae282b88 Finding 6: every module requires the mesh modules it builds with
The SDK, the assigner, the builder's buildrun, the indexer, the
pipeline, the watchman, mesh-enrolment and mesh-grants (and through the
SDK the checker's checkermsg and mesh-tools' node-tools) imported
packages of modules their go.mod did not require at the zero version;
the placement's go.work over the whole repository hid it, and a build
of the module alone with -mod=readonly refused it. Each now requires
them (beside a relative replace where the module keeps its siblings so),
and the indexer's and watchman's duplicated lines go.

Builds: design 47 G §427 (the group's check builds every importer); delivery review round 1, finding 6

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:21:14 +01:00
jschoubben 3e61b70517 SD5, BG11, BLD10: the build modules' shared code moves into the delivery SDK
All of mesh-build-go's buildstep Go module leaves mesh-catalog for
modules/mesh-delivery-sdk: the step run, fetch and release and the
regenerate-and-compare step as the package steprun, the CPU share as
steprun/buildcpu, the conformance kit as steprun/conformance, the seat
generator as seatgen with cmd/seatgen, and cmd/mesh-pack. The three
build modules and the builder's and checker's tests import the SDK and
keep no copy; the SDK requires nothing of mesh-catalog. Code the build
modules share is the delivery domain's SDK, not one module's package.
It carries the build-module round's two new files of that package
(dropdetected.go 247c422f, storedbuilds.go 904b8aed).

Builds: design 47 G §464, §680, §327, §420, §495

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:18:34 +01:00
jschoubben 71a35a6376 MV1: move contracts and sdk under modules/, importers follow
The delivery repository's contracts and SDK live under modules/ as
mesh-delivery-contracts and mesh-delivery-sdk, their Go module paths
renamed to match the folders (the TypeScript names already did), and
every importer in mesh-delivery, mesh-catalog, mesh-host, mesh-tools
and mesh-sdk follows in the same group: a design as it should be, one
path per module, checked by the group's check building every importer.

Builds: design 47 G §427, §88

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:09:56 +01:00
jschoubben 7f53665beb Builder: a by-hand build answers an ask as asked once it is put, not once noted
mesh/delivery merged: source.main moved to novox/mesh-delivery@bf36f8444562
mesh/delivery-group group fix/47-G-reader-release-2 merged: every member is merged
mesh/check checking 7f53665bebb5 on bf36f8444562 | novox/mesh-delivery#205 in group fix/47-G-reader-release-2
builder_build_again's answer (BuildAgainResult.Asks: "the ask ids put") was settled when the ask's id was
noted in the key, before its put: the answer could come back naming an ask not yet on its stream (the check's
flake in TestAnAskTheKeyNamesAndNobodyPutIsPutAtStart, "after 0 asks", about 4 runs in 100 under load), and a
put the stream refused after the note was answered as asked, the key's failure unsaid. The watch is now told
after the put; a refused put ends the look and the answer says the key's failure.

Builds: lead answer A-148 (hq G-20, 3ce1dcf: the fix rides the release), issue 1126 note 72 (builder_build_again answers the asks put), ADR 0668 §1 (the note and the put are one act)
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 04:00:03 +01:00
jschoubben b57281f5a4 RD-3: the validator accepts a foundation part's own findings stream
mesh/delivery closed: a newer head of the same pull request
mesh/delivery-group group fix/47-G-reader-release-2 rejected: composed together: the checker's verdict at the members' heads (12ff6ae3438d): integration: mesh-…
mesh/check failed: integration: mesh-delivery-builder/internal/build.TestAnAskTheKeyNamesAndNobodyPutIsPutAtStart: buil… | b57281f5a406 on 2f1b60f2a231
A foundation part keeps its old sections for good, its findings stream
among them; the trunk refused the new indexer manifest's
mesh-delivery-indexer-findings as outside the predefined forms.

Builds: design 47 G §529, A-30, A-146 (hq 618ad2b7)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 03:12:46 +01:00
jschoubben cf2db47e57 RD-2: the validator accepts one module claiming the seat node-engine
G's node-engine claims its seat as one module; the trunk refused every
claim of a seat the engine holds. One claim is accepted, a second refused
naming both.

Builds: design 47 G §508, §494, §621

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 03:11:42 +01:00
jschoubben 4d1e4e6e6e RD-1: the validator reads a seat-named view in consumes
seat:<seat>.views.<state> is accepted where the seat's definition offers the
state as a view, and refused naming it where it does not or the seat is
unknown; the trunk called the seat: prefix no usable name.

Builds: design 47 G §621, §616, §699

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 03:10:46 +01:00
jschoubben f39572c878 RD-0: the judge's state rule names max-mib among a state's words
mesh-sdk's reader release reads max-mib on an old state section and names
it in its refusal of an unknown word; the judge's row reads that refusal.

Builds: design 47 G §494, §469

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 03:10:46 +01:00
jschoubben 512bb3c75c Join 10: the assigner reads its outside-wait settings from the files its manifest declares
The validator refused the manifest: a process's env is not filled from config. As A-112 says, a process reads each
setting from a file with the content ${config:<key>}, read at its start (the builder's form); a missing or empty file is
the default, a content that is no positive whole number stops the start, naming the file.

Builds: design 47 G §633, §706, A-112

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 02:50:38 +01:00
jschoubben 9b3cc53db9 Join 10: the validator takes a seat's accepted kind on a stream in invokes at parse, as its seat rule does
The per-manifest invokes rule refused seat:<seat>.<stream>.<kind> (the pipeline's seat:node-build-go.check.step) before
the seat rule that accepts it was reached; the test now runs both rules on each row.

Builds: design 47 G A-102

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 02:49:04 +01:00
jschoubben 6563094d20 Merge branch 'feat/47-G-fix10-flake' into feat/47-G-join10 2026-11-12 02:39:12 +01:00
jschoubben 21540afaac Merge branch 'feat/47-G-fix10-validator' into feat/47-G-join10 2026-11-12 02:39:12 +01:00
jschoubben b5074699da Fix 10: the catalog client imports no other seat: the key codec and the source-branches follower move into mesh-delivery's sdk
Builds: design 47 G §614, §670 (ADR 0625 §4; lead answer A-144)
2026-11-12 02:26:55 +01:00
jschoubben fd3788c517 Fix 10: the indexer's source catch-up and trunk directories are answered in name order, not a map's
Kind: an order asserted or acted on that came from ranging a map.
Builds: design 47 G §15, §115, §362
2026-11-12 02:21:03 +01:00
jschoubben 5f3410cd24 Fix 10: the node-build-image acting-rule test lives beside the other hand-written tests; the pipeline's go.mod drops an unused require
Item 3: seatgen -check no longer names go/seats/nodebuildimage/acts_test.go (not written by the generator); the
test moves to the domain SDK's buildstep, which already reads the build seats' definitions. mesh-delivery-pipeline
no longer imports meshmoduleassigner.

Builds: design 47 G §324, §397

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 02:19:06 +01:00
jschoubben e6f91ed349 Watchman: time a build seat's ask from its step-progress, not from the holders' steps (fix 10, A-136)
Builds: design 47 G §483, §496, §602, A-136
2026-11-12 02:18:50 +01:00
jschoubben 91b1719af9 Fix 10: the validator accepts a consumed view of a seat and an invoke of a seat's accepted kind
Items 1 and 2 of the round: a consumes seat:<seat>.views.<state> is accepted where the seat offers the state as a view,
an invokes seat:<seat>.<kind> or seat:<seat>.<stream>.<kind> where the seat accepts it.

Builds: design 47 G §616, §699, A-102, A-131

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 02:17:45 +01:00
jschoubben ac153497f6 Join 9: the builder reads the build seats' steps in seat form, at the seat's holder (A-116, A-128)
module.json reads seat:node-build-<language>.steps as the checker and the watchman do; the
tools bundle reads <holder>.steps, the holder found by seatlist.HolderOf where it is read.

Builds: design 47 G A-116, A-126, A-128

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 02:06:19 +01:00
jschoubben bce3c96acb Join 9: the indexer, teller and pipeline name no seat list verb in their operatorask contract (A-126)
operatorask finds the holder through seatlist.HolderOf, so Contract.Lists and ListBody are gone.

Builds: design 47 G A-126

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:51:54 +01:00
jschoubben 4ed1f4c451 Merge branch 'feat/47-G-fix9-routeproxy' into feat/47-G-join9 2026-11-12 01:46:51 +01:00
jschoubben fed8acb376 Merge branch 'feat/47-G-fix9-catalog' into feat/47-G-join9 2026-11-12 01:46:51 +01:00
jschoubben f684304ca1 Merge branch 'feat/47-G-fix9-grants' into feat/47-G-join9 2026-11-12 01:46:51 +01:00
jschoubben 0655c45a27 Merge branch 'feat/47-G-fix9-serves' into feat/47-G-join9 2026-11-12 01:46:51 +01:00
jschoubben 529729f21b Merge branch 'feat/47-G-fix9-delivery' into feat/47-G-join9
The view's holderOf keeps the seatlist.HolderOf form of builder2 (A-126) over fix9-delivery's own assignments read.

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:46:51 +01:00
jschoubben 7428711d94 fix9-10: TestTheGrantsPartWhole: one reader of the part's durable on the stream running, and an ack settled before a consumer is read
The loop opening the part's own membership's streams bound the part's durable on SEAT_node-engine_running beside hearRunning, so the event running went to either reader and the state running stayed empty at random (about 1 run in 15 under load). The loop now leaves that stream to hearRunning. The subtest that compares a consumer's ack floor before and after acked asynchronously and failed 1 run in 30; it now waits for the ack's reply. The failure of an until in the whole-part test also names what the part said of running.

Builds: design 47 G §556, A-19

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:40:25 +01:00
jschoubben 6d9a7b8aae Checker follows the assignments of the holder of the seat mesh-module-assigner found at run time; FollowAssignments, AssignerModule and AssignmentsBucket go
buildrun gains AssignerHolder, AssignmentsOf and SleepFor (moved from the builder's program, which uses them), so
the builder and the checker follow the holder's first-view tool, views family and state alike; the checker's
manifest consumes the seat's views assignments and reads its assignments state, its composition reads the
picture once followed. The assigner's callers list for the first view gains the checker.

Builds: design 47 G A-82, A-119, A-126, A-131
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:38:34 +01:00
jschoubben 9a3af4a44b buildstep: BuildModuleOf goes, a build module is the holder of its build seat on the seat list
No caller is left (the checker, the watchman and the view find the holders; the builder's reader looks a step up by its seat).

Builds: design 47 G A-82
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:38:34 +01:00
jschoubben 565a90c71d Merge branch 'feat/47-G-fix9-builder2' into feat/47-G-fix9-checker 2026-11-12 01:34:16 +01:00
jschoubben 316cf8a3be The steps of the build seats are watched and read by their holders: no caller of BuildModuleOf is left but the view's
The watchman asks the seat that places modules who holds each build seat (seatlist.HolderOf) and watches that
holder's steps; its manifest reads the seats' steps and invokes the seat's assignments. The builder's stuck
reader looks a step up by its seat, the tests find the holders on their test seat list, the watchman's
integration bed answers who holds a seat. Its manifest tests take the manifest's requires.

Builds: design 47 G A-82, A-126
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:34:12 +01:00
jschoubben 9757688f56 fix9b2-1b: FollowAssignmentsIn takes the bucket; FollowAssignments keeps the fixed one for the checker, which another change owns
Builds: design 47 G A-119
2026-11-12 01:32:40 +01:00
jschoubben bd20ba5b8f Checker: the build modules are the holders of the build seats on the seat list, never a name
The checker's fixed names of the build modules (buildmodules.go in its program, rules and check) go: the
Examiner finds each build module by the language its seat's acting rule builds (buildrun.BuildSeats over
the seat list's definitions and the holders the indexer's modules name by their manifests' claims), the facts
carry the language where a level counts by it, and the program's manifest reads the steps and toolchains of
the seats and hears their toolchain-reported. The tools read the steps of each holder and follow the seat
list as the view does. Timers stay (A-118).

Builds: design 47 G A-82, A-118, §204
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:31:24 +01:00
jschoubben f299a1a8b9 fix9b2-6: the publish queue sends in the order it queued, whatever the clock says between two versions
Builds: design 47 G §588 (newest first)
2026-11-12 01:31:19 +01:00
jschoubben a5bb2ba5b5 fix9b2-2: the builder's process answers the seat mesh-builds' verb reserved; the tools bundle no longer serves it
serves beside the process in the manifest (no bus), the catalog half's carriers and seat mesh-catalog.versions used in the process; builder_build stays the bundle's.

Builds: design 47 G A-115, A-127, A-87
2026-11-12 01:30:37 +01:00
jschoubben 6034559dc2 fix9b2-1: the builder follows the assigner's view in seat form, its holder found at run time
consumes seat:mesh-module-assigner.views.assignments, reads seat:mesh-module-assigner.assignments; the holder is asked of the seat list (seatlist.HolderOf), the first view is the holder's first-view tool (A-131), the assigner's callers list gains the builder; FollowAssignments takes the bucket.

Builds: design 47 G A-119, A-116, A-131
2026-11-12 01:28:12 +01:00
jschoubben 89bbd20b5a fix9b2-3: the builder's operator asker names no list of the seat holders (operatorask finds the holder itself)
Builds: design 47 G A-126
2026-11-12 01:25:50 +01:00
jschoubben 418bf4f54f fix9b2-4: the view's build usage finds a seat's holder with mesh-sdk's seatlist.HolderOf, no lookup of its own
Builds: design 47 G A-126, A-82 (the view part of fix9-6 70e5845b taken in with the manifest tests' reader of fix9-1 09839e5d, which the view's tests need)
2026-11-12 01:23:47 +01:00
jschoubben e69f55468c fix9-1: the teller, view and watchman manifest tests' reader takes requires, and hold the findings as requires
Builds: design 47 G §383, §387; A-30
2026-11-12 01:23:28 +01:00
jschoubben fba07cba40 fix9-serves-3: the indexer validator's process-bus test follows A-127 (serves beside bus accepted, inside bus refused)
Builds: design 47 G A-115, A-127

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:19:59 +01:00
jschoubben ce8ab8b4aa fix9-serves-2: the grants part reads a process's serves beside its bus; a bus-less process's serves are the module's own account's
Builds: design 47 G A-115, A-127

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:19:38 +01:00
jschoubben af8de82d59 Fix 9.7d: the judge accepts a read of a seat's state where the seat declares it
Builds: design 47 G A-128 (A-116)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:19:33 +01:00
jschoubben bc1857ec73 fix9-9: the grants part composes the node-engine's state bounds (key write with a time to live, delete, watch) for every node's engine
Builds: design 47 G §560, A-77, A-92

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:18:52 +01:00
jschoubben 1eb481ccc8 Builder: the manifest names no other module, the floor reads the seat git and the catalog half
The floor's tags are the seat git's verb tags and its requirements what the catalog half's entries
name for the package (indexer_requirements and the forge bridge's bridge_tags go from code and
manifest); a catalog revision the builder hears wakes a silent floor (the forge stream's consume
and its wake go). The guard test says A-107 relaxes ADR 0437 section 8 for a seat's verbs and
accepted kinds. The integration bed creates the state bounds the step bounds are kept in.
The assignments view's seat form (A-119 (3)) is not built here.

Builds: design 47 G §7, A-82, A-107, A-119
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:18:40 +01:00
jschoubben fd8f019751 Builder: a step bound already past ends at once, a key's time to live is at least a second
Builds: design 47 G A-77, A-101, A-118
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:18:40 +01:00
jschoubben b8abf3ed3b Fix 9.7a: the grants part resolves a read naming a seat to its holder
Builds: design 47 G A-116 (§636, §616)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:16:54 +01:00
jschoubben 8fc1997b1b fix9-8: the grants part composes the node-engine's grants for the seat mesh-recovery and for a module's catch-up tool
The node-engine of a node hears the kept events ended and restored through an ordered consumer, and calls the catch-up tool of a module placed on its node (its manifest's kept data name it); the verbs snapshot-kept, restore-kept and kept-points were granted already as the engine's invokes. No nodegrant mirror lives in mesh-delivery (it is mesh-host's).

Builds: design 47 G §406, §554, §631, A-108
2026-11-12 01:13:03 +01:00
jschoubben 90718ba7a3 fix9-7: a module that hears a seat's kept event is granted that stream's info (process.HearSeatEvents reads it); the forge bridge's bed holds the grant
Cause of the five forge bridge integration failures: HearSeatEvents (G §641) asks STREAM.INFO of the kept stream, which the grants part never composed.

Builds: design 47 G §641, A-19, §556
2026-11-12 01:10:17 +01:00
jschoubben 46b5d409bf Fix 9.4b: meshcatalogclient: Ready and Entry over the branch follower, the entries rows, the entry-not-found finding and the entry_again tool, built once
Builds: design 47 G A-103, A-15, §614

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:09:46 +01:00
jschoubben eaa578a4b9 Builder: an ask's step bounds are keys with their own time to live
buildrun.Asker takes optional Bounds and Expiry: the stand-still bound and the cap of three bounds are
the keys stand.<ask> and cap.<ask> of the builder's state bounds, whose expiry the builder's watch of
that state tells the Expiry, and Wait ends then; no timer of the process. With no Bounds (the checker's
Asker, which the lead's A-118 leaves as it is) Wait keeps its timers.

Builds: design 47 G A-77, A-101, A-118
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:07:35 +01:00
jschoubben 13c5433c0d fix9-6: the view's build usage finds the build seats and their holders, never a build module's name
build_usage reads each build seat's steps and pauses through the seat; the view's tools follow the seat list (view_seat_list, view_seat_list_again) and ask the holder of each seat of the seat mesh-module-assigner.

Builds: design 47 G A-82, A-74, §204
2026-11-12 01:07:00 +01:00
jschoubben b3f7054345 Builder: the operator's ask uses mesh-sdk's operatorask asker
The builder's own lookup of the seat holder and read of the router's record (routerBucket, recordVia in
cmd/mesh-delivery-builder/retake.go) are deleted: the ask is published and the router's decided heard
through operatorask.Asker, and each warrant is held to its ask and acted on once by the operator-channel
client's Take.

Builds: design 47 G A-101 (one operator-channel asker in mesh-sdk), §700, A-74
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:05:42 +01:00
jschoubben 62e56af786 Builder: the dead candidate machinery goes
Builder.Candidate, ForgetCandidate, considerCandidate, trunkHead, TrunkMoved, the cands and via
maps, the package-member wait that read via.Members (memberBuilds, memberEnded, MemberBoundEnded,
the member bound key) and the committed build output modules/mesh-delivery-builder/mesh-delivery-builder
are removed. Nothing fed Candidate in the process: the builder follows no candidate and learns a
run's builds from the build step ask. Their tests go with them.

Builds: design 47 G A-84 (the builder follows no candidate), §194, §348, §473
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:04:23 +01:00
jschoubben a8601f5a5c fix9-5: the indexer, the runner and the teller read the router's record through mesh-sdk's operatorask; no copy of the seat-holder lookup, no messenger_asks constant
Builds: design 47 G A-101, A-74, §700
2026-11-12 01:03:31 +01:00
jschoubben e1bf32b9fb Builder: the start's sweep keeps a key of a fingerprint a followed half's picture holds
The follower closes Ready before it tells its entries, so the sweep at ready could close a building key
whose entry was not taken in yet and the entry then asked again (four asks where two). The sweep now
takes the fingerprints of the halves' pictures as current.

Builds: design 47 G §348, §479 (the builder reads the catalog half per watched branch), issue 1660's sweep
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:02:27 +01:00
jschoubben 9c70fa6599 Fix 9.5: the seat node-build-image's build acting rule acts on kind:image
Builds: design 47 G §324, §397

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 01:02:09 +01:00
jschoubben d260113d51 fix9-4: the mesh-wants wanted stream keeps each want's last word with no age limit
The generated contract is unchanged by seatgen (the keep is read from the definition).

Builds: design 47 G A-114 (§693, A-61)
2026-11-12 01:01:30 +01:00
jschoubben 1e2091fcba fix9-3: the indexer judge's process-bus rule accepts serves, read whole by the grant composition
Builds: design 47 G A-107, A-109, A-110
2026-11-12 01:00:31 +01:00
jschoubben 6d94262f8c fix9-2: the enrolment's manifest test holds its findings as requires (two states, the findings state and the finding stream)
Builds: design 47 G §383, §387; A-30
2026-11-12 00:59:48 +01:00
jschoubben 6d423fb3dc fix9-1: the teller, view and watchman manifest tests' reader takes requires, and hold the findings as requires
Builds: design 47 G §383, §387; A-30
2026-11-12 00:59:22 +01:00
jschoubben 3a2b6f4a9c Join 8: the first-branch reserve test expects the entry's fingerprint on the reservation (A-76)
Builds: design 47 G join of rounds 4-8
2026-11-12 00:28:51 +01:00
jschoubben 938531cb10 Join 8: one-line join mismatches (builder stuck steps, republish test Built, indexer judge CatchUp pointer)
Builds: design 47 G join of rounds 4-8
2026-11-12 00:17:24 +01:00
jschoubben fcd849be7a Merge branch 'feat/47-G-judge5' into feat/47-G-join8
# Conflicts:
#	modules/mesh-delivery-pipeline/manifest_test.go
2026-11-12 00:14:13 +01:00
jschoubben f79ef33b4b Merge branch 'feat/47-G-buildfix6' into feat/47-G-join8 2026-11-12 00:14:02 +01:00
jschoubben 26eb65e0a2 Merge branch 'feat/47-G-recover-runner' into feat/47-G-join8 2026-11-12 00:14:02 +01:00
jschoubben bf610ec08a Merge branch 'feat/47-G-builder6y' into feat/47-G-join8
# Conflicts:
#	modules/mesh-delivery-builder/buildrun/asks_test.go
#	modules/mesh-delivery-builder/cmd/mesh-delivery-builder-tools/main.go
#	modules/mesh-delivery-builder/cmd/mesh-delivery-builder/main.go
#	modules/mesh-delivery-builder/internal/build/numbers.go
#	modules/mesh-delivery-builder/internal/build/run.go
#	modules/mesh-delivery-builder/internal/build/stuck.go
#	modules/mesh-delivery-builder/internal/versions/publish.go
#	modules/mesh-delivery-builder/internal/versions/reserve.go
#	modules/mesh-delivery-builder/manifest_test.go
#	modules/mesh-delivery-builder/module.json
2026-11-12 00:13:58 +01:00
jschoubben 4f056485f2 Merge branch 'feat/47-G-builder6' into feat/47-G-join8 2026-11-12 00:12:54 +01:00
jschoubben 3524c880ea Merge branch 'feat/47-G-indexer6b' into feat/47-G-join8
# Conflicts:
#	modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer-tools/main.go
#	modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/integration_test.go
#	modules/mesh-delivery-indexer/cmd/mesh-delivery-indexer/main.go
#	modules/mesh-delivery-indexer/internal/index/pending.go
#	modules/mesh-delivery-indexer/internal/index/pending_test.go
#	modules/mesh-delivery-indexer/manifest_test.go
2026-11-12 00:12:54 +01:00
jschoubben 150acc753e Merge branch 'feat/47-G-indexer6a' into feat/47-G-join8
# Conflicts:
#	contracts/seats/mesh-wants/seat.json
2026-11-12 00:12:14 +01:00
jschoubben d4e82c8aff Merge branch 'feat/47-G-kepton7' into feat/47-G-join8 2026-11-12 00:11:54 +01:00
jschoubben ef6eb0023a Merge branch 'feat/47-G-outside5' into feat/47-G-join8 2026-11-12 00:11:54 +01:00
jschoubben 56cfbb757a Merge branch 'feat/47-G-teller5' into feat/47-G-join8 2026-11-12 00:11:54 +01:00
jschoubben a2dfbec30d The builder no longer watches the gate's source for candidate base merges
A candidate comes by the runner's build step ask (A-97), so the builder's trunkSource watch of the gate's source, its
sourceHeads, the wake it gave a floor, its read mesh-delivery-gate.source and the bed's source bucket go.

Builds: design 47 G A-97, A-84
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 00:10:29 +01:00
jschoubben 8160dc8d26 A-97: the builder takes the runner's build step ask on mesh-builds and answers its end
The seat mesh-builds' accepted kind step (cherry-picked contract 0dc8c723 of feat/47-G-recover-runner) names an entry by
fingerprint; the builder reads it through the catalog half or the seat mesh-catalog's entry, builds it through its one claim, plan
and lanes (a build per fingerprint, no pull request number) and says the end as step-ended.<node> under the ask's id, naming each
entry as asked. A build already done is passed at once; the end of a build wakes its waiting step through the log entry.

Builds: design 47 G §230, §194, §473, A-84, A-91, A-97, A-99
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 00:07:53 +01:00
jschoubben 009c4c6e73 A-97: the seat mesh-builds accepts the build step and says its end
The accepted kind step (body StepRun: the pipeline, the branch, the source revision and each entry by module and
fingerprint) and the event step-ended.<node> (StepEnded: the same entries, the outcome), as mesh-wants has for its
composition step.

Builds: design 47 G A-97 (§230, §194, §473)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 00:04:41 +01:00
jschoubben 84bcdb687a BL18: build modules found through their build seats' holders on the seat list
The builder finds a build module as the indexer's seed does: the build seat whose acting rule
`build` has an `on` matching the artifact's language or kind:image, and that seat's holder, read
from the seat list's definitions and the claims of the catalog half's manifests. Task.Module, every
lane key, the unpublished modules, the toolchain sources, the ends watched, the sayer and
builder_stuck (through `<seat>.steps`) derive from it; the floor's sources are the holders of the
seats git and mesh-catalog. buildrun.GoBuildModule, NodeBuildModule, LanguageOf,
buildstep.BuildModuleOf use, build.ImageBuildModule and StuckBuildModules are gone from the builder
(the checker keeps its own names in two small files until its part reads them from the list).

Builds: design 47 G §7, §428, §704, §204, A-82
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 00:04:34 +01:00
jschoubben 5bed0cd831 grants-serve: a process's serves compose its call and tool subscribes and, for a chunked verb, its chunk publish and ack subscribe
Replaces A-60's grant of chunk subjects to the bundle's principal.

Builds: design 47 G A-107, A-109, A-110
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 00:00:23 +01:00
jschoubben 224d57fbcf RN5: the runner's whole-module integration test against the embedded bus
Starts the program, takes a take-in.taken, sees the pipeline placed and its build asked, takes the build's step-ended and
answers a session's review through the seat, the proven caller recorded; the pipeline then ends passed.

Builds: design 47 G §22, §44, §54, §70, §482, A-106, A-107

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:57:16 +01:00
jschoubben 88699377d2 RN4: the runner's process answers review, rerun, accept and cancel
A review ends a placed review step with its proven caller; rerun asks a step again under a new ask saying it is a rerun
and by whom; accept takes a failed optional step; cancel ends a running pipeline cancelled and drops its asks' bounds.
Each writes `pipelines` by compare-and-set, says step-ended, step-started or pipeline-ended, and records its hand act
first, through AnswerSeat.

Builds: design 47 G §22, §70, §482, §30, §325, §394, A-107

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:54:26 +01:00
jschoubben 960c8e104a §416, §25, A-104: a step ask carries the kept results of its package and the toolchain of its language
The asking half reads, in one pass for all a pipeline's asks, the kept entries whose package is the artifact's package from
the catalog entry or lies beneath it, and the runner's own toolchain per language, kept in the new state toolchains as
heard from toolchain-agreed.

Builds: design 47 G §25, §416, A-104

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:43:35 +01:00
jschoubben 160961a1f4 §535, §647, A-77, A-104: an ask no build seat holder takes within five minutes ends its step
The runner arms, before it puts an ask on a build seat's work queue, a key of its new state bounds (key-ttl) for five
minutes, deletes it when the holder's ask-taken is heard, and ends the step could not run naming the seat when the bus's
marker of the key's expiry is heard: no timer, and no look at the seat list.

Builds: design 47 G §32, §535, §602, §647, A-77, A-104

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:42:12 +01:00
jschoubben db942e9204 §88: a restarted runner asks the steps placed and not yet asked
Starter.Resume asks again each running step of a branch's running pipelines under the id it was placed under; the branch
view tells Views.OnReady once when it holds its first half, and the runner resumes that branch then.

Builds: design 47 G §22, §24, §88

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:40:22 +01:00
jschoubben f067f2cdb0 A-104: an optional step still waiting does not hold a pipeline's end
Only a required step still waiting or running holds endPipeline; a code review nobody gave on an optional policy no
longer keeps the pipeline open. The review verb itself is not built: see the report.

Builds: design 47 G §22, §70, §482, A-104

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:39:07 +01:00
jschoubben 53db5c8dd9 A-102: the runner names the accepted kinds it puts steps on in invokes, and build joins the step inputs
The manifest's invokes names seat:mesh-builds.step, seat:mesh-wants.step and each build seat's check.step; the seat's
definition gives rerun, accept and why-carried inputs and the started pipeline's steps the value build, as the result's
step enum has it.

Builds: design 47 G §22, §24, A-97, A-99, A-102

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:38:37 +01:00
jschoubben 977b69ce07 RN3: the runner asks the seat mesh-wants for the composition step and hears its step-ended
Place puts composition running, asked of mesh-wants at its accepted kind step with the pipeline's commit,
fingerprint, revision and source; the hearer takes mesh-wants' step-ended as the build seats' ends.

Builds: design 47 G §22, §24

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:37:55 +01:00
jschoubben 92ce8c777c A-99: the build is every pipeline's first step, asked of mesh-builds for the module's own entry
The runner's step enum gains build; Place puts the build first, required whatever the policy names, and asks it of the
seat mesh-builds naming the module's own entry by fingerprint; the hearer takes mesh-builds' step-ended as the other
seats' ends, held to its one entry.

Builds: design 47 G §230, A-91, A-97, A-99

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:34:17 +01:00
jschoubben dc024ae552 BL17e: the read of an ask's steps is a kept call: a fault ends no key, the watch is taken up again from its last revision, past five minutes unanswered it is call-unanswered on a bound key
JetStreamAsks.WatchAsk opens the watch as a kept call and takes a closed watch up after the last revision heard; the first
fault arms a key of the state bounds with its own time to live (StepsBoundKey), whose end while the read is unanswered raises
call-unanswered about the ask, and the answer ends it.

Builds: design 47 G §568, A-77
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:33:20 +01:00
jschoubben 6bd156e4a6 A-97: the seat mesh-builds accepts the build step and says its end
The accepted kind step (body StepRun: the pipeline, the branch, the source revision and each entry by module and
fingerprint) and the event step-ended.<node> (StepEnded: the same entries, the outcome), as mesh-wants has for its
composition step.

Builds: design 47 G A-97 (§230, §194, §473)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:32:53 +01:00
jschoubben 6c852a8eea Assigner: hears build.ended and version-released, reads no build log; a want's version and parts come from them
A kept build's or another branch's build names its parts and keeping node from build.ended; the trunk's entry names its version and parts from the version-released whose source is the kept assignment graph revision's. The parts' contract comment says <module>:<artifact>.

Builds: design 47 G §379, §525, §526, A-94, A-96, A-67

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:32:50 +01:00
jschoubben b3cd0ef661 indexer: a watched branch other than the first is taken in from its source into its own revision, a pure computation from its heads' merged messages
sourceFollow takes source.<branch> for every branch the seat lists (the answer with no branch), ApplyBranchSource computes each module's
fingerprint, inputs and graph node over a view in memory seeded from the branch's newest revision, and keeps it with KeepBranchEntries;
the trunk's modules, manifests, taken state, graph and packages are not written. The trunk branch is named once (index.TrunkBranch).

Builds: design 47 G §13, §14, §291, ADR 0666 §6, A-85, A-90, A-93
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:31:30 +01:00
jschoubben fdf7387b8e §610: the runner's seat definition drops every verb's named callers
Builds: design 47 G §610, A-75

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:31:26 +01:00
jschoubben d1357239e2 Builder: says build.ended itself on its own stream mesh-delivery-builder-builds
Each done build's end is published as build.ended.<module>.<fingerprint> (escaped) with the module, fingerprint, made digests, kept-on and branch, where the log entry is written.

Builds: design 47 G §379, A-96

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:30:47 +01:00
jschoubben 8ea78f709a BL1: the whole package-published per artifact on the registry seat's published, from the reservation and the step result
When a registry seat says published, the builder says the seat mesh-builds' package-published once per artifact the reservation
newly marks: the artifact reference, version and digest published, the watched branch and the source revision kept on the
reservation from the entry the build came from (A-57), and the dependencies of kind 1 (resolved) and 3 (toolchain) the step result
named (§466, §673), their parts the artifact references the entry's edges name. The reservation keeps the dependencies from the
build's end until the publication.

Builds: design 47 G §52, §334, §349, §371, §466, §673, A-57
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:30:45 +01:00
jschoubben cdd1169bd4 RN3 (asking half): the runner places a pipeline's steps from the policy and asks each build seat for its step
A step the module's policy does not name is no step (A-91); a bypassed step is asked of no one; an artifact no
build seat names ends its step could not run naming it; an approval due at the start is asked there. The hearer is
named by the runner's own module, the asker the router's decided names.

Builds: design 47 G §22, §24, §26, §44, §54, §103, §323, §476, A-91

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:30:41 +01:00
jschoubben 088f55f94c BL5 (watched-branch half): a build carries the branch and source revision of its catalog revision, and only the first watched branch reserves
An entry the builder takes from the catalog half carries its origin: the watched branch, the source revision of the catalog revision it
came from and whether the branch is the first of the module's registration. A build of another branch reserves no version and is
built and delivered by its fingerprint; a reservation of the first branch keeps the branch and the source revision for the
publication.

Builds: design 47 G §371, A-57
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:28:11 +01:00
jschoubben 12e3f2dc48 BL17d: builder_build answers a module's build keys whole; builder_builds_since takes module; builder_stuck's fingerprint pinned whole
builder_build reads the builds and asked states, and the tools bundle follows the catalog half itself (registrations for the
watched branches, revision per branch) for `newest`; the manifest names the tool and the two seat verbs.

Builds: design 47 G §589, A-87
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:28:08 +01:00
jschoubben 5524cfa8d8 BL6: the builder follows the catalog half per watched branch through the shared branch follower
The builder adopts meshcatalogclient's branch follower on its views reader (A-5, A-15): the modules, their manifests (kept from the
entry that holds them, by its digest), their packages and each package's name in its ecosystem are read from the catalog half's
entries, never the indexer's modules, manifests, candidates and packages views; an entry of a branch other than the module's first
builds its fingerprint and supersedes only its own branch's older one; the start's sweep runs once every followed half's first view
is in; the builder's tools bundle reads package names through the same follower. A run's candidate is no input of the builder
(A-84): its read of the indexer's candidates view goes, and the entry point for a run's build ask is not built (no line gives the
ask's form). The seats' events the builder's own handler takes are named per seat so the follower's events have one taker.

Builds: design 47 G §348, §479, §614, A-5, A-15, A-84
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:27:01 +01:00
jschoubben 457b08ce15 Assigner: hears the builder's build log and writes a kept build's parts and keeping node into the want
The want names parts (by <module>:<artifact>) and kept-on from the build's end, only for a node whose engine states want-parts.

Builds: design 47 G §526, §379, §525, §671
2026-11-11 23:26:52 +01:00
jschoubben 56a6c64586 A-89: the runner asks its approval and reads the warrant from the router's record through the seat holder
Builds: design 47 G §37, §700, A-74, A-89 (routerRecordOf copied from the indexer's b0d2841f, to move into mesh-sdk)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:26:22 +01:00
jschoubben 7ee394b7d9 A-D10, A-D12, A-D13: the runner takes a step's end only as asked, keeps its results, and asks the approval step last, ended by its warrant
The hearer (internal/pipeline/steps.go) takes a build seat's step-ended only from the subject of the node that ran it, for an ask
the runner made of that seat, at the pipeline's commit and fingerprint; a taken end is written by compare-and-set, logged, its
output kept in step-outputs and its passing results in kept. A pipeline ends once every step ended, passed only when every
required step passed or was carried. The approval step is asked as operator-channel's accepted kind ask once every other required
step passed, and ended by the warrant read from the router's record (A-89), the decided event only waking the runner. The program
hears step-ended; the approval's Asker and decided handler wait for the answer on where a process finds the seat holder (A-74).

Builds: design 47 G §24, §26, §27, §37, §700 (A-89, A-74); recovers 18e10200 and 89687404 in today's form

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:25:28 +01:00
jschoubben 50cca4309f BL17c: the operator is asked once a key's event builds are spent; Build once more builds it as a person's build, Leave it nothing
The builder's asker on the seat operator-channel (level approve, about the key, state asked), the teller's three bus
adapters (publish, the router's record through the seat's holder on the seat list, decided heard through the hub's
events handler); the manifest uses the seat and consumes decided.

Builds: design 47 G §568, A-74
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:25:00 +01:00
jschoubben e27160571a indexer: go.mod requires the nodeengine seat directly, which its code imports
Builds: design 47 G A-86 (handover item 3: go mod tidy of the nodeengine require; tidy cannot run offline, the one line is made by hand)
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:24:51 +01:00
jschoubben 31792235e6 indexer: the build-edges state for builds of another watched branch, pruned on registration-changed, outdated kind 1 against the branch's newest build
BuildEdges.fp is the entry's fingerprint in the branch's revision whose source the build names; the branch's newest build
is kept as heard in heard as branch-build.<module>.<branch>.

Builds: design 47 G §374, §375, A-83, A-80, A-85
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:24:41 +01:00
jschoubben a245c2f1e9 Contract: the seat mesh-wants' want names the node that keeps a kept build in kept-on
Builds: design 47 G §526, §379, §271
2026-11-11 23:23:30 +01:00
jschoubben 13550328a6 indexer: a catalog revision per watched branch, branch.<branch>.<n> beside trunk.<n>, and revision answering per branch
The first watched branch's revisions stay trunk.<n>; catalog-revision names its branch, escaped. Nothing yet takes a
non-first branch's source revision in (KeepBranchEntries has no caller).

Builds: design 47 G §291, §614, A-85
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:22:34 +01:00
jschoubben 2c8dff86b5 RN3 (take-in half): the runner starts one pipeline per entry of a take-in.taken, a second start writing nothing
Builds: design 47 G §44, §54, §103, §476 (recovers the start of d8dfc557 in the form the design has today)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:20:32 +01:00
jschoubben 64def921ea indexer: an input is also keyed by its run ask's id and deleted at the build seat's step-ended of that ask
KeepInput takes the ask's id. It has no caller yet: the indexer publishes no run ask for its validation in this tree.

Builds: design 47 G §354, A-78 d
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:19:29 +01:00
jschoubben 2339eb60b8 BL17b: a key failed on a transport fault is built again on the events that say its cause passed, counted in event-builds
Builds: design 47 G §568

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:19:08 +01:00
jschoubben bdc9a61524 indexer: the first fill's edge entries, marked filled, from the placement and the stream running read whole
VersionEdge gains filled (mesh-catalog seat contract, regenerated).

Builds: design 47 G §377, A-78 c, A-62, §556
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:17:28 +01:00
jschoubben 381b55ef53 BL17a: a key failed on a transport fault says it as 'transport fault: <class>, <seat> <node>, <cause>'; drops a committed binary
Builds: design 47 G §568, A-76

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:16:40 +01:00
jschoubben c6af94fe58 indexer: outdated for kinds 3, 5 and 6; the acts of wait-ended kept as heard
Builds: design 47 G A-78 a, b, A-80, §374, §375
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:13:38 +01:00
jschoubben 5b6175714b BL12 / G-16 §588: the builder publishes reserved versions again, on an event by stream sequence and by builder_publish_again
The reservation keeps the fingerprint of the catalog entry it was made from (versions.Source, A-76). The state sections
publish-queue (max-mib 4) and acted (max-mib 1); a consumer acting once per message of the node-engine seat's running and
manifest-reads-changed (why returned) by its stream sequence, the running of every subject read at the start with
lastPerSubject; one queue per holder sent one at a time as the registry seat's publish with the digest and no parts, the
seat and the package name read from the entry (A-73, A-76); builder_publish_queue and the new builder_publish_again, a
hand act. The old form goes: build.NewPublishAgain / ModePublishAgain, versions.Acts.PublishAgain and the
Again* decision, and the integration step that refused it.

Builds: design 47 G §588, §369, §695, A-73, A-76 (G-16, G-18, G-20)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:12:32 +01:00
jschoubben 260a16181c BL7: reserved by name from the catalog half's view, builder_versions calls it
The builder's tools bundle serves reserved given a package's name: it follows the catalog half's packages view itself, finds the
module from the name, answers the reserved version, or for a version no reservation holds asks the seat mesh-catalog's versions
and answers released with the release's digests; a name no entry carries, two entries carry, or a version neither reserved nor
released is answered error. builder_versions by name calls reserved through its invokes. The builder's process serves no call.

Builds: design 47 G §572, §582 (A-70)
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:12:27 +01:00
jschoubben bec5e063bc indexer: what it heard (steps-since, call-since, toolchain, delivered, pending) lives in the state heard, each key part escaped
The own-build state keeps its one key.

Builds: design 47 G A-80, §73, §375
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:10:36 +01:00
jschoubben efcc8125af BL9: a group run's build names each package member's build by its digest
A candidate's module is fetched against each package member of its group by the digest of the member's build (fetch `builds`),
the member out of the fetched packages; a member not built holds it with wait-held naming the member, its bound a key of the
builder's bounds state with its own time to live (A-77), a failed member or one missing past the bound fails the step naming it.

Builds: design 47 G §373, §465 (A-77)
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:09:33 +01:00
jschoubben d9066aa1c6 indexer: the release's edge entries, outdated for kinds 1, 2 and 4, toolchain-agreed and version-delivered kept as heard, the verb input and its state
Kind 3, kinds 5 and 6, the first fill's edge entries (§377) and the deletion of an input at its ask's step-ended are not built.

Builds: design 47 G §374, §375, §354, A-68

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:07:45 +01:00
jschoubben 1a234ccea9 §484: the status view reads the oldest waiting ask in both forms of the accept subject
Builds: design 47 G §484, §600

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:06:11 +01:00
jschoubben ee30209040 §706 (grants part's unit case): the assigner is granted the conditions it reads and nothing of the watchman's findings
A module that invokes the seat mesh-conditions' verb conditions and consumes condition-raised, condition-changed and
condition-cleared is composed exactly those subjects, and no read of another module's findings.

Builds: design 47 G §706
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:05:15 +01:00
jschoubben 2992b08a11 §469 (GR, A-8 line of G): a bucket composed from an old state section takes its maximum size from its max-mib
The grants part's composer gains Bucket.MaxMiB and Bucket.MaxBytes() (as mesh-sdk's buscompose has them): the bucket's stream is
created with that cap and an assertion raises a held one to it; an entry naming none keeps the mesh's cap, so no bucket of today
changes.

Builds: design 47 G §469, §695
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:05:15 +01:00
jschoubben 626a824e65 indexer, mesh-catalog contract: an unwatch of a branch a placement names is refused as placed
The indexer asks the seat mesh-module-assigner's verb placement (input {module}, answer {placements: [{branch, nodes}]}, A-62)
before an unwatch is proposed and refuses one whose branch a placement names, with the reason placed (new in the seat
mesh-catalog's contract) naming the placement; its manifest invokes the verb.

Builds: design 47 G §704 (unwatch), A-62
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:04:51 +01:00
jschoubben 844a2443a5 Assigner: says wanted in the same write as each want, kept last per node and module
Each want the assigner writes (the rules' wants, a backup answer's, a put's) and each removing want is said `wanted` on
the subject of its node and module, each escaped as a name, with the revision and source of the kept assignment graph
revision; a removal carries the fingerprint last wanted. A put that wrote nothing says nothing; with no revision kept the
journal says wanted was not said.

Builds: design 47 G A-61 (§693, §683, §556), A-67

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:04:51 +01:00
jschoubben e9d2997760 indexer: the first fill of the versions from builder_versions, then versions-filled
Filled once, as released, with each module's highest published version; an unanswered builder_versions holds it and, after
five minutes, is call-unanswered. The edge entries of the first fill (§377) wait for answers.

Builds: design 47 G §372

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:04:14 +01:00
jschoubben 5d33692d7f Assigner: the pass keeps an assignment graph revision per catalog revision taken in, first
The pass computes the assignment graph revision (assigngraph.Compute) from the catalog halves it follows, the placements,
the first branch of each registration and each node's capability reading, keeps it in the objects assignment-revisions
through a bus adapter modelled on the indexer's, says assignment-revision, and holds the kept revision and its catalog
source for the wants.

Builds: design 47 G A-67, §292, G-5 "the wants follow the trunk's assignment graph"

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:04:14 +01:00
jschoubben 676d4bace4 indexer: the router's record of an ask is read through the seat operator-channel's state asks, under the indexer's own name
routerRecordUnread is replaced by routerRecordOf: operatorchannelclient's Record is a get of the key (<module>.<id>) on the
process's own bus connection (process.Conn.Ask), in the bucket formed from the seat's holder on the seat list (the seat
mesh-module-assigner's verb assignments with seats) and the contract's StateAsks, no module's name in the program. The manifest
uses operator-channel and invokes that verb.

Builds: design 47 G §700, A-74
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:04:04 +01:00
jschoubben 60b1479e8a A-71 (builder): toolchain-wait-minutes reaches the builder as a file the manifest declares, read at its start, never its environment
The manifest gains the file resource toolchain-wait (content ${config:toolchain-wait-minutes}) and names its path in
MESH_BUILDER_TOOLCHAIN_WAIT_FILE; main.go's toolchainWaitOf reads it.

Builds: design 47 G §672, A-71 (G-20)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:03:11 +01:00
jschoubben a2ac794e7a GR-chunks (A-60, §681): the chunk subjects of a chunks verb go to the principal that answers it, the reverse to an account naming it; the keeper's standing restore of restricted streams
The seat list's verbs saying `chunks: true` (ChunkVerbsOf, as KeptEventsOf) give the principal that answers the verb (a module's
own account for a seat it holds, the tool runner's for a carried module's) the publish of the chunk subjects and the
subscription to the acks, and an account naming the verb by name in `invokes` the reverse; a `*` entry none. The bus module's
keeper holds a standing grant of the restore subjects of the restricted streams, and only those.

Builds: design 47 G §681, A-45, A-60
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:03:05 +01:00
jschoubben e85432c9f6 indexer: hear package-published, release a version once every artifact is published, say version-released; the verb versions
The state versions (64 MiB), a late older version recorded and not said, the newest 100 kept per module and never the
highest of a MAJOR.MINOR; the artifacts published so far are kept as pending.<module>.<version> in the own-build state.

Builds: design 47 G §349, §369, A-69

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:02:12 +01:00
jschoubben 5bbd78ad66 JUDGE: the runner's manifest test reads step-log as an old logs section, the indexer's foundation test lists the node-engine's module
Builds: design 47 G §470, §627

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:00:47 +01:00
jschoubben 9f65ca98d3 GR9/GR10 (A-5, A-52, §684, §444, §614): the grants part follows the catalog half through the branch follower on a views reader, and composes a want's account from its entry
The part adopts meshcatalogclient's branch follower on a views.ProcessReader holding its held finding writer (so its
view-waits is the reader's); the manifest of the build a want or a have names is the catalog graph's entry of that
fingerprint, not a builder's build (the `builds` read is gone); until every first view of the catalog half is in, the pass
keeps the list in force and only adds, says so in its log and in grants_first_views.

Builds: design 47 G §684, §444, §614, §191, A-5, A-52
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:00:41 +01:00
jschoubben d2441d5fcc indexer: a wanted that says the want removed empties that member from named
A member a running put in a set leaves it also when the want of that node and module is removed (the node left or the module was
unplaced), whatever that node last said running; a running or a wanted older than the removal does not bring it back, so a
restart that reads the two streams in either order reaches the same sets.

Builds: design 47 G §675, §693
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:00:14 +01:00
jschoubben 86bae053b6 indexer: kept while named, the state named of the wants and running builds that name a fingerprint
The indexer consumes the seat mesh-wants' wanted (on wanted.<node>.<module>, kept last per subject: the seat's definition gains
the two tokens and the keep) and the node-engine seat's running, each read whole at its start and followed; it keeps in the
old state section named (max-mib 4) one key per fingerprint with its set of <node>.<module>, written by compare-and-set. An
entry object is removed only when no kept revision lists it and its set is empty, and not before both streams were read and the
sets reconciled; its entry-index key goes with it. indexer_entries reads the set, indexer_named_drop removes one member by
hand (class act, said in the hand-act log first).

Builds: design 47 G §675, §695, A-61
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:59:59 +01:00
jschoubben 5906cecf19 BL16 (integration bed): the test bed's build seat workers take both forms of an accept subject, and the stale ask is put as the builder's
Builds: design 47 G §600, §481
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:59:28 +01:00
jschoubben c2a3f3553f Assigner: serves the seat mesh-module-assigner's verb placement
Builds: design 47 G A-62 (§704, §402)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:59:03 +01:00
jschoubben 940889c2a2 indexer: the seed's steps fetch carries the entry's packages; the time a seat is unanswered is kept in the own-build state
Builds: design 47 G §704, A-66

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:58:21 +01:00
jschoubben 9493d0d289 Contract: the seat mesh-wants' wanted is said per node and module, kept last per subject
Builds: design 47 G A-61 (§693, §683, §556, §73)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:57:31 +01:00
jschoubben c0e2621bba indexer: the seed asks steps of each artifact's build seat from the newest trunk entry
The seat list's build seat per artifact (language or kind), a kept call
<seat>.steps with {module, artifact, fingerprint, fetch}, and the finding
call-unanswered (scope call, id <seat>.steps) after five minutes, cleared on an answer.

Builds: design 47 G §704

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:56:06 +01:00
jschoubben 6cec46cc77 Assigner: the outside wait's settings are read from the program's environment, and the bed has a keeper
Builds: design 47 G §706, §633

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:53:42 +01:00
jschoubben 0f62358fb0 indexer: the findings registration-history-filling past 80 % and seed-waits kept until the warrant
Builds: design 47 G §704 (registration-history, seed findings), §8

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:49:57 +01:00
jschoubben e089fd9c3c indexer, mesh-catalog contract: manifest-accepted carries problems, the validator's strings
Builds: design 47 G §692, §668

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:48:51 +01:00
jschoubben 00ec7af34e Assigner: serves the seat mesh-wants' verb input and reads the kept inputs
Builds: design 47 G §354, §338

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:48:43 +01:00
jschoubben aa34cd20dd indexer: entry-index and proposals declare their max-mib caps (8 and 4)
named is not declared: the section is not built yet.

Builds: design 47 G §695, §469

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:48:04 +01:00
jschoubben 661b735060 D-29 (builder half, waits): the builder's old state waits declares max-mib 4
publish-queue 4 and acted 1 come with BL12, which makes the sections.

Builds: design 47 G §695, §672
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:47:54 +01:00
jschoubben 6530702037 JUDGE (§469, §695): an old state section entry takes max-mib, bounded as the objects section's
The judge reads the field through mesh-sdk's catalogue (feat/47-G-maxmib6, 1dc848d7): rows in the G words test accept 128 and refuse 0 and 9000 (they fail without that sdk), and the unknown-field message test names max-mib in the state form. The whole judge package needs this sdk and the bus5 sdk (ab3e7a7) together: with either alone one test of the other's change fails.

Builds: design 47 G §469, §695

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:47:51 +01:00
jschoubben 28cb212030 BL16: the builder puts its asks on accept.<queue>.builder, and a step key neither form parses is named in builder_stuck's journal
The delivery SDK's buildstep gains AskerBuilder, AskSubjectBy and ParseAskSubjectBy (an ask's subject names its
asker as the last token, main's form names none; ParseAskSubject reads both). The builder's put and its held-ask
reads use the builder's subject. Not built here: §543's refusal (the build modules'), the grants (grants part).

Builds: design 47 G §481, §484, §543, §600
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:47:40 +01:00
jschoubben 2b37238b30 JUDGE (§627): the node-engine's module is a foundation part, its findings stay in the old sections
Foundation gains mesh-host, the holder of the seat node-engine (§627, ADR 0619 §1); a row in the G words test accepts its old state and stream mesh-host-findings (fails without it).

Builds: design 47 G §627, §529, A-30

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:47:18 +01:00
jschoubben 48dfe36084 Assigner: a moved module's failing check on an outside cause is a wait that ends by itself
The wait (step outside, on, bound, clock-from, the settle, conditions-unread), its events, finding and ask,
assigner_waits and assigner_release with how, the settings, and a machine's own open network holding its wants.

Builds: design 47 G §706 (assigner), §498, §276, §633, §700

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:46:58 +01:00
jschoubben b46da94f50 indexer, mesh-catalog contract: a branch named candidate or entry is refused as reserved branch name
Builds: design 47 G §704 (branch named candidate or entry)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:46:36 +01:00
jschoubben 78825dc580 GR11 (A-51, §388): the grants part's first-view-unanswered, first-view-empty and binding-unlisted through the held finding writer
The part's state `findings`, its finding stream `mesh-grants-findings` and the consume of `mesh-conditions.findings-asked`
are declared in module.json; the process makes mesh-sdk's held writer (Asked from the contract) and starts it once its
state is bound. Its other conditions stay said to the operator channel. gofmt of bus.go and grants_test.go.

Builds: design 47 G §388 (G-8), §529 (G-12), A-51 (G-20)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:45:48 +01:00
jschoubben efce28c996 JUDGE (§584, A-54): every stream of a foundation part is a predefined form, its old sections kept for good
keptUntilMoved passes the streams of a Foundation module (the findings stream <module>-findings, distribution-events); a row in caseTwoModulesCannotDeclareOneStream names distribution-events (fails without the change).

Builds: design 47 G §584, A-54, A-30

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:45:40 +01:00
jschoubben 0dec003660 indexer: an image artifact's package is {image, module/artifact}
Builds: design 47 G §694

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:44:38 +01:00
jschoubben dcaf4d4084 JUDGE (§470): the runner's step-log is an old logs section kept 100 days of 128 MiB
The manifest declared step-log as a stream; §470 amends §85 to a logs section (max-age-days 100, max-mib 128), the form the judge's predefined-forms rule accepts.

Builds: design 47 G §470, §486

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:44:34 +01:00
jschoubben df82ca5959 JUDGE (A-30, §529, §387): the teller, the view, the watchman and the enrolment ask their findings in requires
Each drops its old state findings and stream <module>-findings for the requires entries findings (state, history kept) and finding-events (the three finding events, 7 days, 16 MiB); none is a foundation part (§529, A-30).

Builds: design 47 G §387, §529, §577, A-30

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:44:34 +01:00
jschoubben 1dcb310184 indexer: revision answers none-yet with no trunk revision (G holder)
Builds: design 47 G §530

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:44:09 +01:00
jschoubben 395c53e63f JUDGE (A-30, §529): a foundation part's own findings stream <module>-findings is a predefined form; the bus fixture serves §681's snapshot verbs
rules.go keptUntilMoved: the stream FindingStreamOf(module) of a foundation module is not refused as outside the predefined forms (the judge's own gwords.go requires it of a foundation part, A-30 says it stays in the old streams section). rules_test.go: rows in caseTwoModulesCannotDeclareOneStream (fails without the change), and caseTheMeshsOwnSeatsAreStillClaimable names snapshot-get, snapshot-restore, snapshot-restore-cancel, snapshot-remove (§681) instead of snapshot-kept and restore-kept (§554, mesh-recovery's).

Builds: design 47 G §529, §681, A-30

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:41:39 +01:00
jschoubben 81d6d548aa GR9 fix: findings-asked from the contract, the start read by HearSeatEvents, kept events known before the seat list is read
The definitions of definedEventsOf name mesh-sdk's three finding events and the seat mesh-conditions's findings-asked
(its generated contract's SubjectFindingsAsked). readRunningWhole is deleted: the part's durable on running is heard through
process.Account.HearSeatEvents with process.OnRead. The bootstrapped definitions name the kept events before the seat list is
read, so the part's first durable never filters running on EVENTS (a held consumer only gains filters).

Builds: design 47 G §556, §641, §644, A-3, A-13, A-17, A-19

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:40:07 +01:00
jschoubben 24d8e4e987 Contract: the seat mesh-wants' wait gains the step outside
Builds: design 47 G §706 (step outside added to §498's list), §498

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:39:00 +01:00
jschoubben 1cad83bad7 VERSION (A-46, §368, §411): every manifest of mesh-delivery says its version MAJOR.MINOR
0.1 for the 6 manifests that said "1" (builder_versions answers none for any name asked); the others already said 0.1.

Builds: design 47 G §368, §411, A-46

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:38:49 +01:00
jschoubben 9e762ec638 G teller: an ask the router refused (the client's Refused with its words) is the ended ask the teller waits on or says
Builds: design 47 G §570, §638
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:36:03 +01:00
jschoubben 0def1a70d7 Watchman: list the machines failing toward x in also of machine.x.network and machine.x.silent
Builds: design 47 G §706 (the watchman's change)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:35:25 +01:00
jschoubben 52241e7a17 Merge branch 'feat/47-G-findings4c' into feat/47-G-dev4-join 2026-11-11 22:25:53 +01:00
jschoubben c8fb62c3ad Merge branch 'feat/47-G-findings4' into feat/47-G-dev4-join 2026-11-11 22:25:53 +01:00
jschoubben 598359ff36 Merge branch 'feat/47-G-grants4' into feat/47-G-dev4-join 2026-11-11 22:25:52 +01:00
jschoubben b815b54bff G findings4 indexer: the indexer's findings are the seat's generated finding written through views.NewHeldWriter, its assignments followed through the views reader
The indexer's CAS Findings store is the held writer through the small FindingWriter interface (Write, Clear, Held): the
unread-call, accepted-unsaid, seat-definition and out-of-step findings are raised and cleared through it, the unsaid ones
read from Held. followAssignments follows the assigner's assignments through the module's ProcessReader (the reader raises and
clears the first view's finding), the emitter and the family-not-heard finding write through the same writer, and the
view-waits finding of the seat git is written by hand through Write and Clear (A-28). The old resolved words go (A-22).
The integration bed has the findings stream and the test sees finding-written said on it.

Builds: design 47 G A-29, A-26, A-28, A-22, A-3, A-14, A-17, A-30, A-37, A-38, §689, §687, §461
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:19:57 +01:00
jschoubben 00f5c1b821 G findings4 mesh-enrolment: the enrolment's reader writes its findings through views.NewStdioHeldWriter
Builds: design 47 G §639, A-37, A-29
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:19:39 +01:00
jschoubben 84d1a5b156 G findings4 builder: the builder's findings are the seat's generated finding written through views.NewHeldWriter, its findings stream in manifest and bed
Builds: design 47 G A-29, A-30, A-17, A-26, A-3, §689, §686, §383
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:18:58 +01:00
jschoubben 99b05bbb2e G findings4 buildrun: the checker's and the indexer's reads of the build modules' toolchains keep the gate over the assignments, which BL8 took out with the builder's
BL8 (8255eb28) replaced buildrun's ToolchainGate, ToolchainSet.Put and ToolchainsBucket by PlacedNodes and ToolchainSet.Set for the builder
(§546, §604); no design line removes the checker's and the indexer's toolchain reads, so the three come back beside them, and
FollowAssignments feeds either.

Builds: design 47 G §492, §604, §546, §472, §574
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:17:09 +01:00
jschoubben 813963a35a G findings4 buildrun: the checker's and the indexer's reads of the build modules' toolchains keep the gate over the assignments, which BL8 took out with the builder's
BL8 (8255eb28) replaced buildrun's ToolchainGate, ToolchainSet.Put and ToolchainsBucket by PlacedNodes and ToolchainSet.Set for the builder
(§546, §604); no design line removes the checker's and the indexer's toolchain reads, so the three come back beside them, and
FollowAssignments feeds either.

Builds: design 47 G §492, §604, §546, §472, §574
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 22:16:37 +01:00
jschoubben 77772056bd G findings4 assigner: the assigner's findings are the seat's generated finding written through views.NewHeldWriter, its catalog halves adopted through the views reader
Builds: design 47 G A-29, A-26, A-22, A-3, A-14, §689, §687, §461
2026-11-11 22:13:03 +01:00
jschoubben f531d5524d G findings4 watchman: the watchman's findings go through views.NewHeldWriter and its own copy of the held writer goes
Builds: design 47 G A-29, §689, §461
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 22:03:27 +01:00
jschoubben 08fcdac0f8 G findings4: each writer is given the seat's findings-asked subject from the generated contract
Builds: design 47 G §383, §390, A-13, A-17
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:59:17 +01:00
jschoubben 0fdf56f4bb G findings4: the readers' findings go through the part's writer as views.WireWriter; the pipeline runner adopts each branch's catalog view through its reader
Builds: design 47 G §689, §687, A-22, A-26
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:58:50 +01:00
jschoubben 7310af36e6 G findings4 watchman: a finding's id keeps the safe key parts its condition's key had
Builds: design 47 G §689, A-14
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:56:38 +01:00
jschoubben 8cbb86dfbd G findings4 watchman: the watchman's findings are the seat's generated type, written through mesh-sdk's finding writer; the resolved words go
Builds: design 47 G §689, §686 (A-3), §461, §384, A-13, A-14, A-22
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:55:43 +01:00
jschoubben c87fc4e6cf G findings4 checker: the checker's check-could-not-run and its views reader's findings go through mesh-sdk's finding writer, which observes the raised ones
Builds: design 47 G §689, §686 (A-3), §639, §384, A-13
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:50:39 +01:00
jschoubben 8e4039a618 G findings4 view: the status view's views reader writes its findings through mesh-sdk's finding writer
Builds: design 47 G §689, §686 (A-3), §639, A-13
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:49:16 +01:00
jschoubben cd6e0ef317 G findings4 pipeline: the runner's views reader writes its findings through mesh-sdk's finding writer
Builds: design 47 G §689, §686 (A-3), §639, A-13
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:48:49 +01:00
jschoubben 67cec41b9c G findings4 teller: the teller's views reader writes its findings through mesh-sdk's finding writer
Builds: design 47 G §689, §686 (A-3), §639, A-13
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:48:23 +01:00
jschoubben 8b41346466 GR4 (§386, §644): the grants part tells catalogue.Hearing which events are defined
A seat definition's events of the seat list, and mesh-sdk's four finding events (views.FindingSubjects), so a `*` emitter before one reaches each declaring module's own stream; any other `*` entry stays the shared stream's.

Builds: design 47 G §386, §474, §644

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:46:19 +01:00
jschoubben 95e2427553 WM6 (§269): the watchman consumes the seat mesh-grants' wait-held and wait-ended, so a granting wait past its bound is acting-part-late
Its handler already takes any seat's wait events; the manifest's consumes gain the two. Not run here: the watchman does not build
against mesh-contracts' meshconditionsclient as it stands (the findings writer's migration is another developer's).

Builds: design 47 G §266, §269, G-20 A-12

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:45:10 +01:00
jschoubben c1a1b027b3 GR10 (A-12, A-10): the grants part says wait-held and wait-ended as its seat's events, and a release ends the wait as released
A release writes an ask to compose; the pass says wait-ended how released once, and a wait whose grant came says how ran. The events go through Conn.EmitSeat.
The late finding is the watchman's (design 47 G §269), not written here.

Builds: design 47 G §276, §266, §269, G-20 A-10, A-12

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:45:03 +01:00
jschoubben 9c68e42c44 A-5 (§614): meshcatalogclient follows the branches once for every part: registrations, the gate's source, views adopted and dropped, entries by fingerprint
Builds: design 47 G §614, A-5 (G-20)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:44:21 +01:00
jschoubben e635f7ba8f CT15 (take-in bodies, none-yet): the seat mesh-catalog's bodies give take-in.taken and take-in.pending; revision answers none-yet in a field
The seat's bodies hold TakeInTaken (branch, source, entries with repository and pull) and TakeInPending (branch); revision's
answer gains none-yet and its revision is optional; meshcatalogclient reads the field, never the error's words. The holders'
and readers' uses of the answer follow (a pointer revision).

Builds: design 47 G §476, §493, §530, §454, §648

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:44:21 +01:00
jschoubben 7574848c5f §702 the seat mesh-wants' wait gains owner, on and words, and its module is optional
The builder's toolchain wait is said with this type, step build; how may be superseded. Fixtures and generated code follow.

Builds: design 47 G §702, §629, §512

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:44:21 +01:00
jschoubben d637a89b5e §690 the seat mesh-delivery's source takes no branch and answers the branches it keeps
source's input branch is optional; given none it answers branches, the branch of each source key the gate keeps.
Fixtures and generated code follow.

Builds: design 47 G §690, §614

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:44:21 +01:00
jschoubben 7024df820a §693 / A-6: the seat mesh-wants' wanted event gains removed
Builds: design 47 G §693, A-6 (G-20)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:42:07 +01:00
jschoubben 0c28d6a716 A-5 (§614): meshcatalogclient follows the branches once for every part: registrations, the gate's source, views adopted and dropped, entries by fingerprint
Builds: design 47 G §614, A-5 (G-20)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:41:28 +01:00
jschoubben 847ab4e1fb GR10: the grants part holds each entry left without a grant as a granting wait, read and released by its tools
Kept in its own state, clock-from the start of this version's first pass, the bound 10 minutes. The seat's wait-held and
wait-ended events and acting-part-late are not built (see the report).

Builds: design 47 G §276, §266, §269 (G-20 A-7); A-6 needs no change: the part reads the wants view and consumes no wanted

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:39:36 +01:00
jschoubben 97e990c8f8 §556: a reader of a stream kept last per subject is granted its ordered consumer
Builds: design 47 G §556 (G-20 A-4)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:37:12 +01:00
jschoubben aac39f1326 G findings4: gofmt of the indexer's and watchman's manifest_test.go
Builds: design 47 G (lead's handover, round 4: gofmt only, no design line)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:34:20 +01:00
jschoubben cad384d483 GR9: the grants part reads the stream running whole at each start, then follows its durable
Until the read ends the part acts on none of running and grants_first_views names the stream waiting; an event older by at
than the one held changes nothing. The ordered consumer's grants are not built (a question to the lead).

Builds: design 47 G §556, §199

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:34:08 +01:00
jschoubben 0b81504139 §616: the grants part resolves a consumed seat view to the seat's holder on record
Builds: design 47 G §616

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:32:42 +01:00
jschoubben 33c6fc4f7f CT15 (take-in bodies, none-yet): the seat mesh-catalog's bodies give take-in.taken and take-in.pending; revision answers none-yet in a field
The seat's bodies hold TakeInTaken (branch, source, entries with repository and pull) and TakeInPending (branch); revision's
answer gains none-yet and its revision is optional; meshcatalogclient reads the field, never the error's words. The holders'
and readers' uses of the answer follow (a pointer revision).

Builds: design 47 G §476, §493, §530, §454, §648

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:32:40 +01:00
jschoubben 92d938dd8c §702 the seat mesh-wants' wait gains owner, on and words, and its module is optional
The builder's toolchain wait is said with this type, step build; how may be superseded. Fixtures and generated code follow.

Builds: design 47 G §702, §629, §512

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:31:18 +01:00
jschoubben f0d041b8dc GR9: the grants part follows today's catalogue contracts and reads a stopped running as stopped
SeatsToPassOn takes what each node-engine's running said and a reader of entries, Assignment names the module and its
branch, Hearing takes the defined-events function (nil here: GR4's). HearRunning keeps a stopped running with no
fingerprint and no manifest, and a stopped module claims nothing on its node.

Builds: design 47 G §404, §459, §199, §386 (nil defines none)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:31:10 +01:00
jschoubben f9df426396 §690 the seat mesh-delivery's source takes no branch and answers the branches it keeps
source's input branch is optional; given none it answers branches, the branch of each source key the gate keeps.
Fixtures and generated code follow.

Builds: design 47 G §690, §614

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:30:49 +01:00
jschoubben f8e509ce56 The assigner and the indexer use the catalog key's codec meshcatalogkey; meshcatalogclient's two wrappers go
BL6 (ba43e400) kept KeyPart and ParseKeyPart in meshcatalogclient until the callers moved; they have, so the wrappers and their duplicate test go.

Builds: design 47 G §670

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:18:40 +01:00
jschoubben 4dc67a98fa The pipeline part and the assigner read the runner's events and pipeline by fingerprint, as CT14 names it
The join with CT14 (08812c7f) renames fp to fingerprint in the runner's Pipeline, PipelineStarted, PipelineEnded; the readers follow.

Builds: design 47 G §534, §550, §585, §646

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:17:19 +01:00
jschoubben 497f87176b The builder, checker, view and watchman read a step key as SD4 has it: ParseStepKey answers asker, node and id
The join with CT-SD4 (6351e988) gives ParseStepKey four values (G §484, §649); the callers that read only the node or the id follow.

Builds: design 47 G §484, §649

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 21:16:18 +01:00
jschoubben 57a4397c90 Merge branch 'feat/47-G-indexer-dev2' into feat/47-G-dev2-join 2026-11-11 21:06:21 +01:00
jschoubben 02f3d8c208 Merge branch 'feat/47-G-builder-2' into feat/47-G-dev2-join 2026-11-11 21:06:16 +01:00
jschoubben ad0282d5e9 IX25: the indexer's manifest declares its findings stream and the keeper's findings-asked, and TestIndexerWhole counts only a views event as a wake
The manifest validator refuses a module that declares the state findings without its stream and the consume (§387), so the
whole test's own manifest was refused; the waiter counted every manifest-accepted, which the indexer says for each manifest it
accepts, as a wake of the views family.

Builds: design 47 G §387, §639, §580

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:54:42 +01:00
jschoubben 21c97051c8 IX1-3: the registrations, the proposals that wait for their warrant, the seed, and the indexer's verbs and tools of them
The seat mesh-catalog's registrations, register, policy, watch and unwatch (each asks the operator, naming every value it
moves, with the change's digest, and writes only on the warrant), the state proposals with an ask id and a digest per key,
the consumer of operator-channel.decided, a restart that reads each open key, indexer_proposals, indexer_proposal_drop and
indexer_seed_again, the seed as one ask. The router's record of an ask is one injected read that fails loudly until the design
says how the program reads it (D-37); the seed's steps call is not wired.

Builds: design 47 G §667, §2, §3, §4, §5, §8, §9, §10, §342, §343, §482

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:53:23 +01:00
jschoubben b584af3f61 BL14: the builder holds an entry whose fingerprint names another toolchain, in its state waits, with wait-held and wait-ended
An entry whose fingerprint names a toolchain version of its language other than
the agreed one is held in the state waits (one key <module>.<fingerprint>), says
wait-held and wait-ended (ran when the agreed toolchain names the version,
released by builder_release) on its stream waits, says wait-held again for every
key at its start; builder_waits and builder_release; its setting
toolchain-wait-minutes. Not built: the bound's finding toolchain-waits (its
scope is not in the design).

Builds: design 47 G §672, §267, §276, §633
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:53:19 +01:00
jschoubben 18f978e852 BL8: the builder hears the build seats' toolchain-reported, keeps them in toolchains-heard and says toolchain-agreed with digests
The builder agrees a language's toolchain from the three build seats'
toolchain-reported, kept in its state toolchains-heard (read back at its start),
forgets a node's on the node-engine seat's running with no fingerprint (stopped)
and never on a placement, says toolchain-agreed with its digests list only when
the agreed version changes; builder_toolchains and builder_toolchains_drop;
the manifest's reads of the build modules' toolchains are gone. The gate over
the assignments is now PlacedNodes, which only counts nodes.

Builds: design 47 G §492, §604, §546, §472, §574
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:49:02 +01:00
jschoubben 1aeccdfb01 IX-numbered: the indexer consumes no version.numbered, so its series fill from the registry seats' published alone
Builds: design 47 G §413

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:41:59 +01:00
jschoubben 69524c6489 IX29 (part 1): the seat mesh-catalog's verb entry finds an entry by its fingerprint through the state entry-index
Each revision kept writes, before it is kept, the digest of the object of every entry that has a fingerprint under that
fingerprint's key; the verb entry (the tools bundle) reads the key and then the object; indexer_entries reads a key and
whether its object is kept. The named set (a want or a running build keeping an entry) is not built: the event wanted
carries no form for a removed want.

Builds: design 47 G §675 (By fingerprint, Its tools in part), §443
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:36:51 +01:00
jschoubben f5b11e1aa0 SD4 (step key parser): ParseStepKey reads both forms and answers the asker
<asker>.<node>.<id> and main's <node>.<id> (no asker); a third form is refused. sdk/buildrun follows.

Builds: design 47 G §484, §649

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:36:06 +01:00
jschoubben 1ddc26087d CT16 (approval carried, pins stated): the seat mesh-delivery says approval-carried and pins-stated
approval-carried.<repository>.<pull> is kept 90 days; pins-stated has the keep of pinned, which is the seat's family.

Builds: design 47 G §542, §579, §652

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:35:40 +01:00
jschoubben 0e67e56c7c CT17 (tag-wanted out): the checker's definition holds no tag-wanted
Builds: design 47 G §528, §645, §321

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:35:24 +01:00
jschoubben bd3727a900 BL10: tagged versions and version.numbered go from the builder
The state tag-asks and its bounds, builder_tag, builder_tag_asks and builder_untag, the checker's tag-wanted
consumer, the branch end's removal of tagged versions, the numbering of a check's build under a tag and the
event version.numbered (its contract in builds, its emit, its manifest line) are removed; a forge message still
wakes a floor. builder_publish_again refuses a held build, since nothing says a version numbered.

Builds: design 47 G §373, §321, §349, §413

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:35:04 +01:00
jschoubben 01be023d26 CT14 (runner bodies): the runner's bodies name fingerprint, a wait may be of the step pipeline, a pipeline keeps its version
Pipeline, PipelineStarted, PipelineEnded, StepEvent and Wait name the build-input fingerprint fingerprint, not fp; Wait.step
takes pipeline; Pipeline gains version. Fixtures and generated code follow. What a pipeline wait says in on is not given by
a line (reported).

Builds: design 47 G §534, §550, §585, §646

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:34:40 +01:00
jschoubben 78c680ce1e SD-fetch (the build ask's forms): fetch names builds, a built artifact its resolved packages, the toolchain its digest
Fetch.Builds, AskBuilt.Resolved and ToolchainUsed.Digest follow the build seats' part, which already names them.

Builds: design 47 G §465, §466

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:33:56 +01:00
jschoubben 28da5e08c3 CT13b (dependency part): package-published's dependency names its part
Each item of dependencies is {kind, part, version, digest}: kind 1 a resolved package's artifact reference, kind 3 the
toolchain's part. Its field artifact is part.

Builds: design 47 G §673, §466, §374

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:33:26 +01:00
jschoubben 02a4ef3497 CT13 (reserved's answers and its client): reserved answers released or error, and meshbuildsclient asks it
reserved answers module, version, artifacts and released (a boolean), or error alone; module, version and artifacts are
read as required only without error. contracts/go/clients/meshbuildsclient (artifact go-meshbuildsclient) has Reserved,
which answers the reservation or release, a Refusal for the error and an error for an answer that is not one.

Builds: design 47 G §679, §582, §586, §650

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:33:08 +01:00
jschoubben 9b6f886577 IX30 (§491, D-15): each entry carries its artifacts' package names, and a name two modules carry is refused
The entry's artifact gains package {ecosystem, name} (the seat mesh-catalog's definition, regenerated), read at take-in
from the revision's own files (go.mod, package.json) through the forge; the validator's PackageNameProblems refuses
every module sharing one name in one ecosystem, naming them, in the trunk's judge pass. An image's name is not written:
the design does not say what it is.

Builds: design 47 G §676, §491, §478, §504, §412
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:30:49 +01:00
jschoubben 848c2b035e BL3: the build seat's ask carries the version the build reserved, empty for a build reserving none
Builds: design 47 G §573, §370

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:28:23 +01:00
jschoubben 7ecae5a6dd CT12: the build seats' ask carries its version, every ask says ask-taken and step-ended (issue 1966)
The builder's reserved version reaches the build in the ask; a holder says when it takes and ends
any ask, a builder's build included, so the watchman times every ask; the toolchains key names its
program's digest; the checker may drop its own asks until its removal. step-progress and ask-taken
name no keep and go on the shared events stream. The delivery SDK's neutral forms follow the part.

Builds: design 47 G §472, §548, §549, §552, §573, §602, §603

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:27:39 +01:00
jschoubben c7ad2477f0 BL6 (key codec): the catalog key's codec is meshcatalogkey, so the builder's builds package reaches no bus
meshcatalogclient imports the new package and keeps two one-line wrappers for the callers of the other parts until
they move to it.

Builds: design 47 G §670, §614 (wiring unchanged)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:26:55 +01:00
jschoubben 996b15cb45 BL13: build.ended names the node that keeps a kept build in kept-on
A build the build node kept, which answers its digest and no reference, is done; its end carries
kept-on once for the build.

Builds: design 47 G §671, §379, §271, §526

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 20:26:55 +01:00
jschoubben 7fca7f0ac8 CT12: the build seats' ask carries its version, every ask says ask-taken and step-ended (issue 1966)
The builder's reserved version reaches the build in the ask; a holder says when it takes and ends
any ask, a builder's build included, so the watchman times every ask; the toolchains key names its
program's digest; the checker may drop its own asks until its removal. step-progress and ask-taken
name no keep and go on the shared events stream. The delivery SDK's neutral forms follow the part.

Builds: design 47 G §472, §548, §549, §552, §573, §602, §603

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 16:01:17 +01:00
jschoubben 2312b05bb5 IX30 (part 2): a revision's one claim of the seat node-engine is accepted, a second and none are refused
Builds: design 47 G §508, §527 (IX30)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 15:51:15 +01:00
jschoubben 268d2be034 IX30 (part 1): the validator's foundation list gains the forge and image registry modules, and a part's findings are judged in its part's form
Builds: design 47 G §529, §577, §584 (IX30)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 15:49:32 +01:00
jschoubben 2c8d3f5b40 BL5 (version half): a build whose catalog entry's version is not MAJOR.MINOR reserves nothing and says so in the journal
The first-watched-branch half (§371) waits for BL6's revision view, which names a build's branch.

Builds: design 47 G §505

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 15:48:04 +01:00
jschoubben 689947bec5 BL11: a build whose published packages cannot be read is refused, naming the unread state
Taken from f051de32 (the old numbering's refusal); the tests of D-B2 to D-B6 it sat on are left out.

Builds: design 47 G §55 (and its check line §56, test 70)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 15:47:42 +01:00
jschoubben fdc482d512 IX28: the entry's manifest-digest carries sha256: and the digits, the module's value the bare digits
Builds: design 47 G §578, §609 (IX28; §500's problems wait on a design question)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 15:47:16 +01:00
jschoubben a3d4e0d8ad IX26: the taken judge row names its version as MAJOR.MINOR
Builds: design 47 G §368, §295, §299
2026-11-11 14:53:05 +01:00
jschoubben e7ef3f3a78 Take out StepRun.names: the step ask no longer carries the registrations' names for a lint scan
The part build-step.json, its generated Go and TypeScript (seatgen, check clean), the three build seats' fixtures and sdk/buildstep lose StepNames and the ask's required names.

Builds: design 47 G §7, §328, §329
2026-11-11 14:51:56 +01:00
jschoubben f366225135 The checker reads the forge through the seat git's verb file, never a module's tool (milestone 47/G W6.14)
The forge read named the forge module's tools (gitea_get_file, and four more never
called), which ADR 0656 §1 and the operator's (d) forbid: whichever module holds the
seat git answers. An absent file is the seat's absent, an error its error, and a call
that reaches nobody stays not heard, so the check says it could not run.
The compare captures no test reads any more go with the commit trees read nothing called.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ

Builds: design 47 G §252, §312, §317
2026-11-11 14:50:02 +01:00
jschoubben fe025a3b73 A check that could not run is asked again on the node-engine seat's running of its part (milestone 47/G W6.9b, issue 1373)
The checker consumes node-engine.running (kept last per subject) through its durable
consumer and hands each running.<node>.<module> to PartRunning; a body naming no part
asks nothing and is said. Naming the not-heard part by its module (the seat git's holder,
a build seat's holder) waits on the catalog half's claims (W3.6): until then the part is
unnamed and the first running asks the check again.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ

Builds: design 47 G §253, §315
2026-11-11 14:49:20 +01:00
jschoubben 0b7cec27e8 A check that could not run says so, releases its claim and waits for its part to run (milestone 47/G W6.9, issue 1373)
A check that failed for a part of the mesh not heard was judged again at
every change of the nodes. It now says could not run, naming the part,
and is kept in the checker's own state could-not-run; only the running of
that part asks it again, once per heads and part at one fingerprint
(PartRunning). Not asked again within an hour it is the finding
check-could-not-run, which clears when the heads are checked again,
replaced, or their pull request closes. checker_status reads the state.
The node-engine seat's running event is wired once its definition lands.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ

Builds: design 47 G §253, §315
2026-11-11 14:49:02 +01:00
jschoubben 99e35b74e6 TL: the teller says answered and reads its answers through teller_answers; the view says reached with each reach it writes (abdf11be)
Builds: design 47 G §431
2026-11-11 14:48:31 +01:00
jschoubben c48c7e723a WM6: the watchman hears an acting part's wait-held and wait-ended and writes acting-part-late once the wait's bound has run from clock-from
Taken from 2d796fe8 (its wait half only; the store and record halves are WM7's, built). The body is the seat mesh-wants' contract Wait.

Builds: design 47 G §266, §269, §277
2026-11-11 14:47:47 +01:00
jschoubben f288270513 W7.3: the toolchain gate takes its placements from the assignment half (design 47 lines 1466-1471, 1487-1490; issue 1966)
Design 47 *Each part acts on its own entries* and *Every part takes a first view, then
follows the events*: the builder reads its placements through the seat mesh-wants'
view, never the assigner's state. The seat's client gets Placed over assignment graph
revisions (ADR 0625 §4: the logic the gate's three callers share), and the gate a
Revision feed; the first revision settles it, a pair new in a later one stands since
that revision's time, as the state's write time did (issue 1940).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ

Builds: design 47 G §348, §195, §200
2026-11-11 14:43:55 +01:00
jschoubben 05494e7bb9 W5.1, W5.2, W5.5: the assignment graph computed per branch, kept as objects, and served by mesh-wants' verbs
Design 47 at hq main b229f5c4, lines 1353-1366 (each entry one module version
on a node, its edges provisioning and acting; each revision naming its inputs,
kept as objects in the old section with its cap, served by the seat's verbs),
1385-1388 (under 256 KiB for 120 modules on four nodes; a 512 MiB cap), 1416-1418
and 522-525 (a node's entries from the catalog graph of the branch its placement
names, by default the registration's first), 909-914 (the placement's build is
the version), 1835-1836 (an edge from the acting part's version to each version
its rule names), and the Reverted table (assignment graph revisions as objects,
form 1).

internal/assigngraph computes a revision from the halves held per branch, the
placements and the capability readings; keeps it numbered after the newest
when it differs, each entry once by its digest; and answers revision, entry
and difference from the kept objects only. The manifest serves the three verbs
and declares the objects assignment-revisions. A placed module whose entry
cannot be computed is named in Uncomputed, never left out in silence.

Not built here (the design does not say, or held): contribution edges;
provisioning to a provider no binding or pin names; tiers; a candidate's
revision (W5.9); removal of a revision no record pins (pins are W5.9's).
The process does not compute and keep yet: that needs the registrations'
first view and a catalog half per branch (handover).

Milestone 47/G, issue 1966. Tests: TestTheAssignmentGraphIsComputedFromItsInputsAndKept,
TestARevisionOf120ModulesOnFourNodesFitsOneValue, TestTheSeatsVerbs/1953/D4-D6
(failed before), TestManifest's objects row (failed with the old manifest).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ

Builds: design 47 G §173, §175, §176, §180, §194, §209, §223, §263, §346
2026-11-11 14:43:17 +01:00
jschoubben ac2c4d3e20 W8.2: the seat-list wiring is mesh-sdk's seatlist.Part; seatlist.go is deleted
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ

Builds: design 47 G §204
2026-11-11 14:42:03 +01:00
jschoubben 58b3b030db GR7: test that a seat's events are published by its holder alone (the holder half of 24149354; its node-backup grant is left out)
Builds: design 47 G §24, §227, §383, §260
2026-11-11 14:42:03 +01:00
jschoubben 9efc402a06 GR3: a kept seat event's stream is made from the definition's keep object: its age (0 for none), its cap, 90 days and 16 MiB where unnamed, dropping its oldest at the cap
Builds: design 47 G §396, §331, §260
2026-11-11 14:41:42 +01:00
jschoubben 4a61381ff1 W8.7 rest, W8.6 (node place): the grants part keeps what each node-engine runs (running, grants_running) and reads seat holders from its digest; a machine's place in an event's subject is the definition's <node>
The part binds its own durable on the node-engine's kept stream (HearKept, tried at every wake until the pass has made it),
the seat's holders are read from the manifest of the digest each node says it runs, and a node-engine's account is granted its
own node at the part its definition names (running.<node>.*) and its durable on the kept stream by name.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ

Builds: design 47 G §199, §249, §309
2026-11-11 14:40:26 +01:00
jschoubben 28ebd45863 W8.7 (kept events): the grants part makes each kept seat event's stream, sourced from the events stream, and each consuming module's durable on it from the last message per subject
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ

Builds: design 47 G §260, §331, §396
2026-11-11 14:39:23 +01:00
jschoubben c4a8590671 W1.5, W1.6 (judge): a kept data's form is from 0 and its catch-up tool the module's own
The node agent calls a restored kept data's catch-up tool from the
restore point, so the judge refuses a form below 0 and a catch-up tool
the module does not declare; a foundation part keeps its new objects in
the old section with their cap and form (ADR 0619 §2).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ

Builds: design 47 G §295, §299
2026-11-11 14:39:10 +01:00
jschoubben 5d3c2c680e B-D14b (judge half): a build seat's toolchain stream is kept by the seat its module claims, not by its name
Design 47 at b229f5c4, *A module's registration*, lines 482-485 ("No part fixes a name": every module name a
part needs is read from the catalog graph; ADR 0666 §5): the validator kept the build modules' toolchain streams
(toolchains-go, toolchains-node) until they move by the modules' names. It now keeps them for the module that
claims node-build-go or node-build-node, whichever module that is. The other entries of the list, the node-engine's
module (engineModule) and the indexer's own toolchain watch are not in this commit. Rows in
TestRulesBus/TwoModulesCannotDeclareOneStream (fail without it). Issue 1966.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ

Builds: design 47 G §364, §428, §535
2026-11-11 14:37:18 +01:00
jschoubben c16e07ba0e B-D14b/W4.8: the toolchain gate takes the build modules a part finds, as it finds them (issue 1966)
Design 47 *A module's registration*, "No part fixes a name" (b229f5c4 lines 482-485): the indexer finds
the build modules from the seat list's acts and the manifests, after the gate is made, so the gate takes
them by UseModules and passes its reports on again. Row in TestToolchainGate: a module given later passes
on at the assignments only once given (fails without UseModules).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ

Builds: design 47 G §364, §428, §535
2026-11-11 14:37:17 +01:00
jschoubben 1dd48d81a0 B-D14b/W4.8: the indexer's integration fixtures hold the build seats with their acts and the holders' manifests (issue 1966, design 47:482-485)
The six integration tests that broke when a language's build module became the module claiming the seat whose acts is step build on that language now keep node-build-go and node-build-node as the seat definitions have them, and mesh-build-go and mesh-build-node as the catalog's manifests claim them; no indexer code changes.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ

Builds: design 47 G §364, §428, §535
2026-11-11 14:37:17 +01:00
jschoubben 371b1a98f6 B-D14b/W4.8 (indexer half, integration fixtures left): build modules from the build seats' acts and their holders' manifests (issue 1966)
Design 47 *A module's registration*, "No part fixes a name" (b229f5c4 lines 482-485), and *What ADR 0656
leaves to this design*, "The indexer reads it [acts] into the catalog graph" (line 1583): ToolchainModules,
ToolchainStreams, BuildGoModule and BuildNodeModule go. The build module of a language is the module whose
manifest claims the seat whose acting rule is step build on it (index.BuildModulesOf), its stream the one of
its manifest carrying toolchain.reported, its bucket <holder>_toolchains as before. Found again at start, at
every change of the seat list and at every catalog revision; the watch, the gate and the hearing follow.
A language with no build module found reads as no toolchain reported.

Rows: TestAgreedToolchainChangesAGoModulesReasonWithNoMerge/the build module of a language is the holder...
(fails without: no BuildModulesOf, and go-builds' report refused); TestToolchainWatch's later build module.
Left: six integration tests of cmd/mesh-delivery-indexer hold no build seat with acts nor a holder manifest
and fail (TestIndexerWhole, TestIndexerWritesAGoModuleAgain..., TestIndexerGivesACandidateItsFingerprint...,
TestIndexerJudgesAnUnreadableVerdictAgainAtStart, TestIndexerCountsOnlyThePlacedBuildNodesToolchains,
TestAMeshSDKMergeMovesOnlyTheModulesImportingAChangedPackage): their fixtures are to be given both.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ

Builds: design 47 G §364, §428, §535
2026-11-11 14:36:48 +01:00
jschoubben 7a7b504836 W5.10 (base): the module graph's node of a catalog entry is read in the domain SDK's graph, for every reader of the catalog half
graph.NodeOf moves from the indexer's own package to sdk/graph, since the assigner reads its verb edges from the catalog
half too (a second reader).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ

Builds: design 47 G §47 to §50, §121, §122, §378
2026-11-11 14:36:24 +01:00
jschoubben 941af88086 The indexer follows its seat list through the wiring every part shares, seatlist.Part, not a copy of its own (milestone 47/G W4.10, W1.9)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ

Builds: design 47 G §204
2026-11-11 14:36:10 +01:00
jschoubben 86d13a41a3 W4.15: a commit the forge does not have is the seat git's kind not-found, never a 404 in the error's words (milestone 47/G)
askGit wraps the kind not-found as index.ErrNotFound; order.go's notFound reads only that. Needs feat/47-G-seats'
seat git at 3b355a35 at the join.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ

Builds: design 47 G §310, §317
2026-11-11 14:36:10 +01:00
jschoubben 91791fdabd The indexer reads the forge through the seat git alone: trees, file, contains and open-pulls, an answer's error a failure (milestone 47/G W4.15a)
The forge module's own tools leave the program and its invokes. The seat's Go contract is feat/47-G-seats' (contracts/go/seats/git); this branch builds against it at the join.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ

Builds: design 47 G §310, §312, §317, §428
2026-11-11 14:32:33 +01:00
jschoubben 42785f6fa2 Merge origin/main into feat/47-G-build 2026-11-11 14:31:52 +01:00
mesh-tools 2f1b60f2a2 Merge pull request 'Registry recovery: break the circle, and let a cut part be sent again (issue 1966)' (#204) from fix/1966-registry-circle into main 2026-11-11 13:18:27 +00:00
jschoubben b4a512e627 Merge branch 'feat/47-G-build' into feat/47-G-build-indexer 2026-11-11 14:14:12 +01:00
jschoubben 7db5b0dfe4 1966 review round 1: Composed counts the bindings written or rewritten from fields; wrap Take's comment
mesh/delivery merged: source.main moved to novox/mesh-delivery@2f1b60f2a231
mesh/check checking 7db5b0dfe479 on 2f1b60f2a231
Builds: design 25 bindings-first-view §6, §8, §9

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 14:12:25 +01:00
jschoubben 3cdecff518 IX26: the indexer's manifest says version 0.1 (none published), checked as MAJOR.MINOR
Builds: design 47 G §368, §299, §295

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 14:11:08 +01:00
jschoubben 5009bb9256 IX23: the indexer keeps no mesh-wide hold, serves no tool or view of modules, and hears no engine's manifest reads
Builds: design 47 G §196, §185, §364

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 14:09:55 +01:00
jschoubben 83b5275fe2 IX22: a test that a merged revision naming a newer indexer is the previous catalog graph revision with only the indexer's entry replaced
Builds: design 47 G §273, §237

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 14:05:04 +01:00
jschoubben 1425374d27 Merge branch 'feat/47-G-build' into feat/47-G-build-watchman 2026-11-11 14:04:20 +01:00
jschoubben ad6c793a2f CK10 (tags): the checker asks no group build through tagged versions
The checker built from G's heads makes no tag-wanted and waits on no published
of a tagged version: tagwanted.go and tags.go go (the verdict sayer stays, in
verdictsay.go), with st.tagged, groupVersions, Case.Tagged, TagAsks, the
PublishedHeard wiring, the group path's tagged Node package and Go packages,
the manifest's two published consumes and the tag-wanted event of asks.

Builds: design 47 G §528, §373, §321

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 14:04:15 +01:00
jschoubben ae8a6f1a6d IX16: the indexer's manifest test lets the assigner's invoke of modules stand until the assigner's own subtask moves it to revision
Builds: design 47 G §263

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 14:03:28 +01:00
jschoubben bcca6028db Merge branch 'feat/47-G-build' into feat/47-G-build-indexer 2026-11-11 14:03:01 +01:00
jschoubben 6a14c1c0af Take out the stand-in for CatalogEntry.ManifestDigest: the contracts developer's field replaces it
Builds: design 47 G §506

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 14:02:47 +01:00
jschoubben 5f64c25935 Merge branch 'feat/47-G-build' into feat/47-G-build-builder 2026-11-11 13:58:44 +01:00
jschoubben ca9aad9757 1966 subtask 2: the grants part composes a binding from an answer of mesh-broker's list without binding
An answer no entry of which carries binding gets, for a key-value or object-store
entry whose settings hold the bus object its bus-name names, the binding composed
from the answer's own fields; a stream, a ledger and an entry not held stay
unbound and are logged once per answer; grants_first_views shows composed and
unbound (1966/AC203-3..n). An answer where any entry carries binding is applied
by §4 alone.

Builds: design 25 bindings-first-view §9, §4, §6, §7, §8

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 13:58:23 +01:00
jschoubben f30c54faa1 IX16: the catalog graph revisions as objects (the research 085 half joined), an entry carrying its manifest whole and the digest of its bytes, a full store holding the take-in's merges
Builds: design 47 G §173, §174, §175, §176, §177, §178, §179, §180, §181, §194, §200, §209, §210, §263, §443, §506

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 13:58:09 +01:00
jschoubben 3442b7af37 TEMPORARY stand-in for CT: CatalogEntry.ManifestDigest in the Go contract only (design 47 G §506); the contracts developer's field replaces it, take theirs at the merge
Builds: design 47 G §506

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 13:58:08 +01:00
jschoubben cb6dc7c320 BL4: the git tag go/vMAJOR.MINOR.PATCH is written on the catalog's version-released, at the commit the version was reserved from
The reservation keeps the repository and commit of the build and whether the module has a Go package; version-released writes
the tag through the seat git's verb tag before the key goes, and a tag the forge did not write leaves the release to be heard again.

Builds: design 47 G §370

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 13:57:54 +01:00
jschoubben aa1ebee3cc Merge branch 'feat/47-G-build' into feat/47-G-build-contracts 2026-11-11 13:57:11 +01:00
jschoubben 73d15c08f2 CT3 (answers): the catalog graph entry carries manifest-digest
Builds: design 47 G §506 (the entry gains manifest-digest, the sha256: digest of the manifest's bytes as the forge answered them, set by the indexer at take-in). Regenerated by seatgen (-check clean).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 13:57:00 +01:00
jschoubben 83ff5c747d Merge branch 'ix16-wip' into feat/47-G-build-indexer 2026-11-11 13:55:20 +01:00
jschoubben fbe34bcf07 Merge branch 'feat/47-G-build' into feat/47-G-build-watchman 2026-11-11 13:54:53 +01:00
jschoubben 276412d7ff 1966 subtask 1: a chunk 0 again starts a part afresh in parts.Receiver.Take
A part the holder lacks travels again whole from chunk 0, so its earlier
chunks are dropped and chunk 0 is taken; any other chunk that is not the
cursor is still refused, naming the cursor (1966/AC203-1, AC203-2).

Builds: design 51 Publishing, the bullet "The file travels in parts through the seat"

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 13:54:40 +01:00
jschoubben 9f43e927e4 WM7 (store-filling): a store clears below 80 % of its cap, not 70 %
Builds: design 47 G §181, §263

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 13:53:50 +01:00
jschoubben 9d79964487 CT2 (answers): mesh-builds' reserved takes a package's name, toolchain-agreed carries digests with their nodes
Builds: design 47 G §478 (reserved takes module or name, with version; an unknown or doubled name answered error, §491), §472, §495 (toolchain-agreed carries digests, each with the nodes reporting it, in place of one digest). Regenerated by seatgen (-check clean).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 13:53:17 +01:00
jschoubben 33d9e942f2 Merge branch 'feat/47-G-build' into feat/47-G-build-assigner 2026-11-11 12:37:06 +01:00
jschoubben 846340c553 AS4: the assigner computes a node's entries from the catalog half of the branch its placement names
The indexer's first views of manifests, modules and graph are replaced by one meshcatalogclient.Catalog per watched branch
(the trunk's from the start, each branch a registration names from then on); the world keeps each branch's modules, graph nodes
and manifests, and a pass splits a module's nodes by the branch their placements name and computes each group's wants from that
branch's half. Not built: AC2 (a composition step on beta only), which is AS5's step.

Builds: design 47 G §14, §184, §191, §194, §195
Tests: TestACommitOnBetaMovesOnlyTheNodeThatChoseBeta (failed with the groups on the trunk alone), TestTheCatalogHalfIsTakenInPerBranch

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 12:37:06 +01:00
jschoubben 38a2492394 RN3 (publish half): a pipeline starts by compare-and-set on its key, and a package-published starts one per dependent behind
A start writes the pipeline's key (watched branch, source revision, module) only when it is absent and says
pipeline-started; a second start of the same revision and module writes nothing. A package-published asks the
catalog's outdated for that package on that branch, a kept call, and starts a pipeline for each dependent behind
by kind 1, keyed by the publication's branch and source revision. The start on take-in.taken, and a gathered
group's one pipeline per branch, wait for take-in.taken's body (design 47 G §476, in review).

Builds: design 47 G §54, §103, §334, §53, §75

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 12:34:26 +01:00
jschoubben 68c10c5664 RN24: the runner's manifest says version 0.1, declares its finding stream and hears the keeper's ask
Builds: design 47 G §368, §383, §387

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 12:31:58 +01:00
jschoubben 7fcf1ce9ee Merge branch 'feat/47-G-build' into feat/47-G-build-runner 2026-11-11 12:28:08 +01:00
jschoubben 2b052791da RN2: the runner reads its policy from the registrations and each watched branch's catalog half, and says when it waits for a view
The runner follows the registrations (a first view, then registration-changed) and, for each watched branch
they name, that branch's catalog half (a first view, then catalog-revision of that branch), each in its state
first-views, read by pipeline_first_views and asked again by hand with pipeline_first_view_again; past five
minutes without a view it writes view-waits. A step's status is read per module and artifact from the
registration, and the build seat of an artifact from the acting rule build naming its language.

Builds: design 47 G §21, §23, §323, §77, §195, §200
Open: design questions Q-RN7 (where a build seat's holder is read, §323) and Q-RN8 (a status left empty, §23).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 12:28:00 +01:00
jschoubben 8688e62cd8 Merge branch 'feat/47-G-build' into feat/47-G-build-contracts 2026-11-11 12:21:56 +01:00
jschoubben e1499f0617 CT4: a wait names its clock and its kind: clock-from, step of the acting steps, a put's fingerprint, a delivery wait's machines; regenerated
mesh-wants' Wait gains clock-from, the step enum of section 203 with put, delivery, kept-build and backup,
fingerprint and machines, and requires step, module and since only (a put's wait has no part);
the runner's wait body gains clock-from. The runner's `step` already names pipeline steps: see the report.

Builds: design 47 G §498, §266, §269

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 12:21:56 +01:00
jschoubben de66361014 Merge branch 'feat/47-G-build' into feat/47-G-build-teller 2026-11-11 12:21:37 +01:00
jschoubben 2c1f5a4033 VW1: the view reads the modules from the catalog half of the trunk, by meshcatalogclient.Catalog
The view's process follows the trunk's catalog half (first view of the seat mesh-catalog's verb revision, then each
catalog-revision of branch main) and hands each changed entry to its model in the form of the value it always kept; its tools
read the newest trunk revision through the verb. The manifest invokes seat:mesh-catalog.revision and consumes
mesh-catalog.catalog-revision instead of the indexer's modules read tool and views family.

Builds: design 47 G §196, test 61

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 12:21:20 +01:00
jschoubben 940d42c659 CT5: the build seats' steps takes drop and why, fetch gains builds, a build names what it resolved, steps are keyed by asker, toolchain-reported and step-progress; regenerated
steps callers: the runner, the indexer, the operator and sessions (D-18); BLD12 builds in the fetch;
BLD13 resolved and the toolchain digest; BLD14 the step key <asker>.<node>.<id> beside main's
<node>.<id>; the events toolchain-reported and step-progress on the three build seats, and
step-progress on mesh-wants.

Builds: design 47 G §463, §480, §465, §466, §467, §481, §483, §492, §496

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 12:20:54 +01:00
jschoubben ce286795e0 CT10: a branch with no revision yet is a ready, empty catalog view
Builds: design 47 G §479, §495

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 12:17:16 +01:00
jschoubben dd8c4d405a Merge branch 'feat/47-G-build' into feat/47-G-build-contracts 2026-11-11 12:15:39 +01:00
jschoubben 5e0c04c3cf CT10: meshcatalogclient follows the catalog half per watched branch, a first view then each catalog-revision of that branch
The view of a branch is named mesh-catalog.catalog-revisions.<branch>; two branches give two views.
A revision heard and not held asks revision once more, said in the log.

Builds: design 47 G §358, §196, §479, §495

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 12:15:39 +01:00
jschoubben 8cfc24fc2e Remove a binary built by mistake in the checker's folder
Builds: none (housekeeping of CK2)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 12:14:50 +01:00
jschoubben 1ec1e0a224 Merge branch 'feat/47-G-build' into feat/47-G-build-watchman 2026-11-11 12:14:30 +01:00
jschoubben 5fc1dbd264 WM11, CK12, EN1 (manifest half): finding stream, the keeper's ask and MAJOR.MINOR version in the manifests of the watchman, the checker and enrolment
Builds: design 47 G §383, §387, §368 (the findings writer half waits for the generated writer of §439)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 12:14:24 +01:00
jschoubben c3068b15e1 CK1: the checker reads no merge turn of the gate and claims a new check at once
Builds: design 47 G §278, §197 (test 52)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 12:10:49 +01:00
jschoubben 21195a06be CK2: the checker takes the trunk heads from the catalog half's revision and catalog-revision, not the gate's source (repairs the checker against the new contracts)
Builds: design 47 G §197, §195, §200

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 12:08:09 +01:00
jschoubben 190fdef8b3 AS19 (the seat list): the assigner wires its seat list reader through mesh-sdk's seatlist.Part
Its hand-wired seatGate goes; the reader, its tools assigner_seat_list and assigner_seat_list_again and the
re-read when the events are live are the SDK's Part. A test searches the code for a wiring of its own.
Left of AS19: the indexer's views and the gate's reads, which wait for AS4's catalog half.

Builds: design 47 G §204
Test: TestTheSeatListIsWiredByTheSDKAlone

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 12:07:39 +01:00
jschoubben 60937e2526 Merge branch 'feat/47-G-build' into feat/47-G-build-assigner 2026-11-11 12:05:11 +01:00
jschoubben ec14823429 AS15, AS16: a provider counts healthy by the node-engine seat's running, and a put ends on it
The assigner hears running.<node>.<module> through its durable consumer on the seat's stream (last message per
subject), counts a provider healthy while its running build is not stopped whatever a newer want of it waits for,
and ends a put when running names the put's fingerprint (a running without one, or stopped, ends none); the have
no longer ends a put. With the stream not heard, rule 5 reads the have as before.

Builds: design 47 G §199, §309; main file "A provider before its consumers" and "Until milestone G, from the have; from G, from running"
Tests: TestAProviderRunsHealthyByItsRunning, the put rows of TestTheBusMovesByTheRulesAndItsUserListRevisionIsWrittenAtOnce, TestAnAnswerCountsOnlyForTheAskingItAnswered (running ends the put)
Manifest: consumes node-engine.running; validator: no finding new against trunk.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 12:05:11 +01:00
jschoubben fdc2cec328 Merge branch 'feat/47-G-build' into feat/47-G-build-watchman 2026-11-11 11:59:01 +01:00
jschoubben cbbb971d35 WM12: the watchman's manifest says its version as MAJOR.MINOR
Builds: design 47 G §368, §372 (0.1 for a module with none published)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:58:33 +01:00
jschoubben 7d1ce3296d Merge branch 'feat/47-G-build' into feat/47-G-build-assigner 2026-11-11 11:58:00 +01:00
jschoubben b1fcabcebe AS3: a placement's branch and build, set by a proposal, bound by the ask, and its build a held put
A proposal sets a module's watched branch and build (a re-place keeps them), the changes digest an ask binds to
carries both, and a placement's build is a held put of that build, released when the placement drops it while a
person's put stays. Taken over from 6bc6fe53 and b8e50fff.

Builds: design 47 G §14, §78, §114, §360, §361
Tests: TestAssignments (place change branch, build, digest rows), aPlacementsBuildIsPut. Test 77 (§79) covered by the put row.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:57:53 +01:00
jschoubben 5fcd76a9f9 WM7: the watchman raises record-open 24 hours after a merge unless another condition covers it, and store-filling from the seats' filling, full and room
Builds: design 47 G §148, §160, §181, §218, §263

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:56:50 +01:00
jschoubben 51e34d5369 Merge branch 'feat/47-G-build' into feat/47-G-build-bridge 2026-11-11 11:56:06 +01:00
jschoubben 4866f7097a Merge branch 'feat/47-G-build' into feat/47-G-build-teller 2026-11-11 11:55:32 +01:00
jschoubben 91a9c41290 gofmt 2026-11-11 11:55:02 +01:00
jschoubben 0b597eb417 FB3, FB4, FB5: the bridge performs what the gate owes through the seat git and says each outcome, reads groups from the seat, and its owed tools
Taken over from the join (6ada2089, f1417ab0, 6e162a60, 3a4e62b0, 73fb42d7, ee15a280, a5476f62, 94a4e62a, 33907a81, e519cc87, e8f268c1) and fitted to the final
contracts: the seat's events are pull-updated, pull-merged, pull-closed, forge-delete; OwedEnded keeps only the fields §164 names; merge-pull
takes no ask. A merge act is performed only as a switched act (§169); from G the gate owes none (§167).

Builds: design 47 G §43, §45, §157, §161, §162, §163, §164, §167, §168, §169, §171, §250

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:54:56 +01:00
jschoubben d7c8fdd0ed Merge branch 'feat/47-G-build' into feat/47-G-build-assigner 2026-11-11 11:54:50 +01:00
jschoubben 1778888acc AS2: the wants keep the trunk-only form until the first registration, and follow the pipelines' ends from it
Builds: design 47 G §95, §130, §353, §352

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:54:50 +01:00
jschoubben a227e061ec Merge branch 'feat/47-G-build' into feat/47-G-build-indexer 2026-11-11 11:53:52 +01:00
jschoubben ee34487126 Merge branch 'feat/47-G-build' into feat/47-G-build-teller 2026-11-11 11:53:45 +01:00
jschoubben 61277b6b9b VW4: the view's manifest says version 0.1, declares its finding stream and hears the keeper's ask
Builds: design 47 G §383, §387, §368, §411

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:53:41 +01:00
jschoubben 55d8e9e73d Merge branch 'feat/47-G-build' into feat/47-G-build-assigner 2026-11-11 11:53:07 +01:00
jschoubben 3b31e6df05 AS1: a want follows a passed pipeline, by compare-and-set per module and watched branch
The assigner hears pipeline-ended and group-ended, keeps the newest end per module and branch in the state written (tool assigner_written), and writes a want only from an end whose required steps passed.

Builds: design 47 G §29, §35, §102, §120, §291, §325, §352, §85

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:53:07 +01:00
jschoubben 43bebef626 WM3: the watchman says machine-away and machine-back of the seat mesh-watchdogs when a machine's presence expires and when it is heard again
Builds: design 47 G §389, §436

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:52:13 +01:00
jschoubben e7bd54e67b IX19: the indexer reads every contracts module's trunk definitions at its start before judging, waits for the seat git at most two minutes, says view-waits past five and judges again once it answers
Taken from the join base (6ce86c96, ff6e74f9) onto the build branch.

Builds: design 47 G §198, §248, §316, §255, §57 (tests 54, 57)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:51:07 +01:00
jschoubben 799241364f VW0: the view reads the trunk's source by the branch key and the per-branch value
Builds: design 47 G §305 (the state source is kept per watched branch), §431

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:50:04 +01:00
jschoubben 69aeb817e2 WM2: the watchman raises build-capacity-waits for a build seat whose oldest queued step has waited 60 minutes
Builds: design 47 G §86

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:49:32 +01:00
jschoubben 07832b1a2c The indexer's whole-module test proves a merge kept as one catalog graph revision, said on the seat, and the recompute and the drop answered by the running indexer (milestone 47/G W4.13)
Rows in TestIndexerWritesModulesAtAMerge; the pin rows come with W4.5.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:48:46 +01:00
jschoubben a217a44f05 The indexer's catalog graph revisions are read and steered by its tools: one revision, every revision with the store's fill, the candidates' halves, a recompute compared with the kept one, and a drop by hand that says room (milestone 47/G W4.12)
Pins and the consumer of the gate's events come with W4.5, which makes them.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:48:46 +01:00
jschoubben 0f618f1998 WM1 (head half): the watchman raises pipeline-stands for a watched branch's head with no pipeline within five minutes
Builds: design 47 G §12, §75, §112 (the head half; the step half waits on a design question)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:48:38 +01:00
jschoubben 3a4768ab43 FB6a: the forge bridge reads trees, files, pulls and tags through the seat git and hears its pull and delete events
Taken over from the join's 473f9323, 5f40d230, 159a679b; the events are the seat's pull-updated, pull-merged, pull-closed and forge-delete.

Builds: design 47 G §252, §310, §312, §317

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:48:36 +01:00
jschoubben 9b9e9f68bb TL4: the teller's manifest says version 0.1, declares its finding stream and hears the keeper's ask
Builds: design 47 G §383, §387, §368, §411

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:48:34 +01:00
jschoubben b2b449c913 The indexer says filling, full and room of its catalog graph revisions and holds a merge while they are full (milestone 47/G W4.6)
Design 47, Two graphs: a keep that would pass the store's cap refuses
the next revision and says full, naming the source revision held pending
with the reason objects full (Pending.Held, which indexer_pending shows);
a keep crossing 80 % says filling; once something removes revisions,
RoomAgain says room below the filling mark and evaluates pending again
(no timer). Each event is said once by its duplicate id.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:48:20 +01:00
jschoubben deb88b17b9 The indexer answers the seat mesh-catalog's verb revision in its own runtime, to exactly the parts that declare it; modules ends as a first view (milestone 47/G W4.4)
ADR 0663: the catalog half is read through revision, answered by the
tools bundle from the catalog graph revisions before it asks anything,
to the parts whose entry in the newest trunk revision declares
seat:mesh-catalog.revision in invokes, the holder refused too; none kept,
every reader waits. The first view modules, its callers list and its
tool leave the manifest; the assigner declares revision instead (its
code moves in W5.10); the grants part keeps its read of modules until W8.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:48:09 +01:00
jschoubben 5595403215 The indexer opens its catalog graph revisions under the module its account runs as, not a fixed name (milestone 47/G W4.2)
A module's name in its own code logic is a fixed name the runtime already
says: the bus account the process runs as names it.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:47:26 +01:00
jschoubben 64afa00457 The indexer's catch-up tool takes no arguments and is named beside its catalog graph revisions (milestone 47/G W4.14)
The node agent calls a restored part's catch-up tool with no arguments, so
indexer_take_in with neither module nor repository takes in the head the
gate's source names for every repository, as the first start's catch-up
does, and keeps the view as the next revision when an entry moved. The
manifest names it beside the catalog graph revisions, form 1 (design 47,
Reverted).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:47:04 +01:00
jschoubben a732cb0cb2 The indexer declares no modules or graph state: its view of the trunk is the catalog graph revisions (milestone 47/G W4.3, the manifest)
The states modules and graph leave the manifest and the names the indexer keeps; their first views and read tools are
answered from the newest revision, whose changes catalog-revision says. The contract keeps the modules type until its
readers moved (the lead's ruling). The manifest validator, built at mesh-delivery's trunk, accepts the indexer in both
cases, change and trunk, and no verdict differs.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:46:55 +01:00
jschoubben 66dd7b3a3f The indexer's tools answer the modules and the module graph from the newest catalog graph revision and wait while none is kept (milestone 47/G W4.3, the graph state's readers)
The tools bundle reads the objects catalog-revisions through its runtime (index.TrunkStates over busstate): the first
views, read tools and seat verbs of modules and graph, indexer_config_readers, indexer_bus_state and
indexer_package_users; the marks of modules and graph are the revision's number, and a view asked before the first
revision says view-waits, never an empty catalog.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:46:55 +01:00
jschoubben 80bc3a4084 The indexer runs on its view of the trunk read from the newest catalog graph revision, keeps it after every write and takes the trunk in at a first start (milestone 47/G W4.3, the view wired)
main.go reads the view and the module graph's nodes (NodeOf) from the newest trunk revision instead of the modules and
graph states; every write outside a recompute (the judge pass's verdicts, a build's imports, the source stamp, the
modules the trunk dropped, the indexer's own entry a held revision writes) ends in KeepView, so a restart loses nothing;
a revision lists every module the view holds, one whose manifest cannot be read too. At a first start whose objects keep
no trunk revision the indexer takes in the head the gate's source names for every repository by the forge bridge's
merged message and keeps revision 1 (the lead's ruling A). The whole-module tests read the view from the revisions.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:46:33 +01:00
jschoubben e0d5488138 The indexer reads its view of the trunk from the newest trunk revision (milestone 47/G W4.3, second part: the view's read)
The lead's ruling on finding 1: modules becomes an in-memory view of the newest
trunk revision read from catalog-revisions at start, one form of the fact
(ADR 0656 §6). TrunkView gives that view as a store in memory and the revision
it was read at; an empty bucket is an empty view. Not yet wired in main.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:45:56 +01:00
jschoubben 9ab20f14f8 The catalog graph entry carries what the next revision is computed from and its package versions (milestone 47/G W3.1, inputs)
The lead's ruling on finding 1: an entry gains inputs (what its fingerprint is
computed from, the toolchains used, problems, warnings, named paths, the source
revisions it was taken in and its fingerprint moved at) and packages becomes
name to version, so the indexer's view of the trunk can be read back from the
newest trunk revision alone (ModuleValueOf). A revision's entries are the values
the recompute wrote, not the values it started from.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:45:56 +01:00
jschoubben 735724899b Merge branch 'feat/47-G-build' into feat/47-G-build-contracts 2026-11-11 11:45:50 +01:00
jschoubben 18c954ddcd CT10: meshwantsclient holds a part's view of the assignment half, a first view then assignment-revision
The typed first view and the following of each half sit in the seats' client packages, built on go/views
(design 47 G §245), so no part follows the assignment half by a follower of its own: a newer trunk revision
heard is waited for, said in the status, asked and held; a candidate's, or one held, asks nothing.

Builds: design 47 G §245, §365

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:45:50 +01:00
jschoubben 04c260bb22 Merge branch 'feat/47-G-build' into feat/47-G-build-assigner 2026-11-11 11:45:37 +01:00
jschoubben 154505f451 Assigner: repair against the new contracts (source key per branch, want with digests, seat verbs not yet served)
Builds: design 47 G §15, §95, §353, §379

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:45:37 +01:00
jschoubben 6ff7aeb5cf The indexer fills the catalog graph entry's main from the module's manifest (milestone 47/G W3.1's main, W4.3)
The entry's main is the from of the Go artifact the module's process runs, which the check's first tier builds when
the module acts.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:45:25 +01:00
jschoubben 6d53c3987a Merge branch 'feat/47-G-build' into feat/47-G-build-bridge 2026-11-11 11:45:19 +01:00
jschoubben d813ce7e39 FB4a: the forge message forms of an owed act's outcome (owed.ended)
The gate's developer needs OwedEnded and its outcomes; fields are the ones §164 and §168 name (id, outcome, words, the seat that said the act, time).

Builds: design 47 G §164, §168

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:45:19 +01:00
jschoubben bd067ae779 The indexer keeps a catalog graph revision at each merge and each moved fingerprint, and says catalog-revision (milestone 47/G W4.3, its writing part)
Design 47 (Two graphs) keeps a catalog graph revision for each source revision taken in and for a fingerprint moved
with no merge. The recompute that writes the module graph now keeps the revision it makes, numbered after the newest
kept trunk revision, and says the seat mesh-catalog's event catalog-revision naming the changed modules; a recompute
that moves no entry keeps none, and objects not yet on the bus keep none, said in the log.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:45:07 +01:00
jschoubben f0b51bfc29 The indexer keeps its catalog graph revisions in its object bucket catalog-revisions, each entry once by digest (milestone 47/G W4.2)
Design 47 (Two graphs) keeps each revision as the list of its entries' digests and each entry as one object, so an
unchanged entry is stored once. The bucket is declared in the old objects section with a 512 MiB cap (ADR 0619 §2:
the indexer is the foundation), opened at its first use; a revision's list is written only after its entries, and a
revision read back with an entry lost is an error naming the module.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:45:07 +01:00
jschoubben ab87109ec5 The indexer forms a catalog graph entry per module and a revision as a list of entry digests (milestone 47/G W4.1, W4.2 form)
The entry is the seat mesh-catalog's CatalogEntry filled from the module graph's
node a recompute computes (build edges, provisions, verbs, the edges left out on a
cycle) with where the trunk holds the module and its manifest's digest; a revision
lists one entry per module by the sha256 of its bytes, so an entry two revisions
share is one object (design 47, an unchanged entry is stored once). Rows in the
graph test: one entry per module, and only a moved entry's digest changes. Kept
as objects, numbered and said with W4.2's store and W4.3.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:44:56 +01:00
jschoubben e00232dcfb Merge branch 'feat/47-G-build' into feat/47-G-build-builder 2026-11-11 11:44:53 +01:00
jschoubben 74da8116db BL2: the build reserves its version at its start; reserved state, tools, verb and findings
The builder keeps one key per module and MAJOR.MINOR in its state reserved, written by compare-and-set when a trunk
build is claimed; nothing is reserved, and the build says wait-held, before the catalog says versions-filled; the key goes
on version-released; a built reservation unpublished past ten minutes is the finding version-unreleased; builder_reserved,
builder_reserved_drop (hand act, recorded) and the seat mesh-builds' verb reserved.

Builds: design 47 G §369, §372, §52, §85 (reserved)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:44:47 +01:00
jschoubben 839bc4a6e5 TL0: the teller's test follows the contracts, the settle ask gone with the verb settle
Builds: design 47 G §431 (the settle ask goes with the verb settle)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:44:42 +01:00
jschoubben 0d24af4e5b Merge branch 'feat/47-G-build' into feat/47-G-build-contracts 2026-11-11 11:44:06 +01:00
jschoubben 496989ccfb CT10: meshcatalogclient follows the registrations, a first view then each registration-changed
The assigner and the forge module's merge switch on their first registrations (design 47 G §353), so the
seat's client carries the typed follower on go/views: a first view asked of the verb registrations, a newer
version heard asked again until the picture holds it, an answer read before the change asked once more.

Builds: design 47 G §353, §245

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:43:53 +01:00
jschoubben bcd0888928 Merge branch 'feat/47-G-build' into feat/47-G-build-indexer 2026-11-11 11:41:25 +01:00
jschoubben 042800cb2a IX15: the indexer reads a branch's source revision through the seat mesh-delivery's verb source and its event source-moved
The catch-up of the heads the source names runs before a source-moved is read, once per branch; the gate's source bucket is no longer read.
internal/index compiles against the new contracts again (SourceByMainValue is gone); tests of earlier subtasks that
the broken compile hid are fixed (the validator's MAJOR.MINOR version in their manifests).

Builds: design 47 G §15, §115, §362

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:41:21 +01:00
jschoubben fc0cb1873a RN15: the runner's read verbs show, list, stands, why-carried and kept, from its own states (issue 1966)
The runner's tools bundle serves the seat mesh-pipeline-runner's read verbs as tools named
<seat>.<verb>, answered from its own states pipelines and kept, never another part's: show one
pipeline whole with its steps and their outputs' names, list by module, branch, commit or run newest
first, stands every step started and not ended with what it waits on and since when, why-carried the
pipeline a carried step came from, kept the kept results by level, digest or package.

Builds: design 47 G §83, §306, §75 (stands), §25 (why-carried)
Not built, waiting on design answers: show's step log (Q-RN6, the step log's section form) and each
store's fill against its cap in show and kept (Q-RN2, where the caps are declared).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:37:51 +01:00
mesh-tools 8f5cbce468 Merge pull request 'Registry recovery: the grants part takes a first view of every binding (issue 1966)' (#203) from fix/1966-bindings-first-view into main 2026-11-11 10:32:34 +00:00
jschoubben 5b0f155116 Merge branch 'feat/47-G-build' into feat/47-G-build-runner 2026-11-11 11:32:31 +01:00
jschoubben cafff10266 RN1: the pipeline runner's module, a foundation part with its kept data in old sections (issue 1966)
The module mesh-delivery-pipeline claims the seat mesh-pipeline-runner, serving its twelve verbs,
asks no template, keeps pipelines, kept, aged, findings and its first views in old state sections,
its step log on an old stream (128 MiB) and its step outputs in an old objects section (1 GiB),
hears the events its pipelines start and end on, and needs the assigner's program delivered first.
Its program stops when its state pipelines cannot be read; its own module is its account's.

Builds: design 47 G §1, §21, §27, §59, §85, §95, §101, §130, §333
Not built, waiting on design answers: §76's health check (its tool's name), §85's caps of the old
state sections (no size field on an old state), step-log's 100 days (the validator's 30-day bound),
and §59's sent-objects (the objects template's cap the design names has no default).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:32:31 +01:00
jschoubben 1ba1c487c7 Merge branch 'feat/47-G-build' into feat/47-G-build-indexer 2026-11-11 11:32:10 +01:00
jschoubben 540b88a946 IX21: the validator reads a manifest's version MAJOR.MINOR and the finding stream and ask of a findings state
The refusal of a status in a manifest (IX20) relies on strict decoding: a manifest
field naming a status is an unknown field and is refused. The `*` emitter of
consumes (design 47 G §386) is held for the design writer's answer on model-usage's
`*.usage.*`.

Builds: design 47 G §89, §368, §387

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:32:05 +01:00
jschoubben 337e620cf1 Merge branch 'feat/47-G-build' into feat/47-G-build-contracts 2026-11-11 11:31:16 +01:00
jschoubben eca4320d1c CT1: the runner's step outcome not asked, a pipeline's end count, and the step log kept 100 days; regenerated
An approval step after a failed required step ends not asked, naming that step (the
fixture of a failed pipeline said waiting before); Pipeline and PipelineEnded carry
end-count, one higher at each end again after a passing rerun. The fixture rows fail
against the contract before (end-count dropped on read).

Builds: design 47 G §24, §325 (not asked), §29, §85, §325 (the end count), §85 (step-log,
100 days).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:31:09 +01:00
jschoubben 0ae849b1df Merge branch 'feat/47-G-build' into feat/47-G-build-builder 2026-11-11 11:30:12 +01:00
jschoubben ab9b8d3471 CT5: the build seats accept step on check and on delivery, and run on check, each kind by its stream; regenerated
A kind's subject is <stream>.<kind>: check.step, delivery.step (a recovery's steps, the
runner alone) and check.run (node-build-go). Regenerated with seatgen at mesh-catalog
b5aebbbe (GEN4); its fixture rows for the three subjects fail to compile against the
contract before.

Builds: design 47 G §415, §455, §22, §206, §86, §338.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:29:13 +01:00
jschoubben bc77fabdad BL15: the gate's source is watched by every watched branch's key; SourceMainKey retired
Builds: design 47 G §15 (source.<branch> in place of source.main), §431 (readers of the source move off the main key)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:28:36 +01:00
jschoubben 6b85c9045e IX20: the validator's tests hold a step's status out of a manifest and read the build seats' new accepts
A manifest naming a status is refused as an unknown field (strict decoding); the
two seat-table tests read the seat definitions as contracts now answer them.

Builds: design 47 G §6, §21, §23, §28, §101, §95 test

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:26:51 +01:00
jschoubben 6bbbceb55f A-D29: a template in the runner's manifest is refused, as in every part on the validator's list (issue 1966)
Design 47 *A module's registration* (b229f5c4 lines 480-481): a unit test of the manifest validator
refuses a template in the manifest of every part on its list, the runner's included. The row of
TestTheIndexerJudgesEveryManifestOnce now judges mesh-delivery-pipeline beside mesh-config; it fails
with the list as it stood before 0ad243c1.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:25:45 +01:00
jschoubben 86eb29f243 A-D29: the pipeline runner joins the validator's foundation list (ADR 0666 §4; issue 1966)
Builds ADR 0666 §4 (the runner is a foundation part: the bus module's own delivery waits on its
pipeline), changing ADR 0619 §1 and §3: judge.Foundation, the one list in code, gains
mesh-delivery-pipeline, so its manifest keeps its state in the old sections and a request of
new-form bus state by it is refused.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:25:45 +01:00
jschoubben 8501968154 Raise and release the bindings' first view at the bound itself, so held events never reach dead letters
mesh/delivery merged: source.main moved to novox/mesh-delivery@8f5cbce46845
mesh/delivery-group group fix/1966-bindings-first-view merged: every member is merged
mesh/check checking 8501968154b4 on 8f5cbce46845 | novox/mesh-delivery#203 in group fix/1966-bindings-first-view
No pause between two failed asks runs past the bound (two minutes): the ask at the bound raises
first-view-unanswered and releases the held events, well inside the events consumer's five deliveries
of 30 s. An answer's binding is taken as it lists it, with no fallback to an event's types (§4).
Checks: the unit start row requires the raise at exactly the bound; the whole test says the created
before the bound and requires the condition raised when it is applied (fails without the process's
hold), and waits on the kept first-views status for the held answer instead of a sleep.

Builds: design 25 bindings-first-view §3, §4, §5, §8 (hq d0760629, PR 543)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:22:57 +01:00
jschoubben c77e747f4e SD2, SD3: the kept-artifact judgement and the neutral pipeline step ask and its end, shared by the runner and the three build modules
Ported from the dev branch (192f6ab2, 4f013f44, dc0df1b5) into the package sdk/buildstep where
they were built; the package is not named by a design line (see below).

Builds: design 47 G §271 (a module claiming oci-artifact-registry but not its holder in the seat
list is refused), §24 (a step's end is published on its node's subject), §416 (the step ask carries
the kept results), §370 (the version).

Not decided: the package of SD2 and SD3. G-9 §420 names sdk/steprun only for the step-run code
(SD1); no line places the kept-artifact judgement or the step ask.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:06:27 +01:00
jschoubben 349a3519ef CT10: meshdeliveryclient reads the source per watched branch; SourceMainKey and the removed-verb rows retire
Builds: design 47 G §15, §305 (a reader names a branch's source revision: SourceKey, the
value SourceByBranchValue), §431 (the five verbs of release 6 leave the definition, so the
list RemovedVerbs and its test go; the settle ask goes with the verb settle).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:05:56 +01:00
jschoubben e1df6af536 CT7: the seat mesh-delivery keeps the state turns, and asks until their last users go; regenerated
Left in the definition: no line of the contracts part removes the state turns, and the
state asks is read by the teller, the forge bridge, the view and the indexer, whose rows
remove their reads; it is removed in the head where its last reader goes (design 47 G §431).

Builds: design 47 G §305, §431.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:05:56 +01:00
jschoubben 20af25ea40 The seat's events wait for the first view unacknowledged; the checks prove the order and the dropped case
The process hands an event of the seat mesh-broker to BindingsView.Hold, which
applies and acknowledges it after the answer or past the bound, so a restart
finds it delivered again (one delivered again while held keeps its place by its
stream sequence). Unit rows: the answer's bucket differs from the held created's
and the held event's stands. Whole test: an answer that lists a binding dropped
since its ask does not write it back (fails without the check). Neutral caller
name in the by-hand asks.

Builds: design 25 bindings-first-view §3, §4, §8 (hq d0760629, PR 543)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 11:01:39 +01:00
jschoubben 3883667254 CT10: meshwantsclient compares wants that now carry their parts by value
The want gained the released version and each part's digest (CT4), so two wants are
compared by value; a table row writes and reads one back. Failed to compile before.

Builds: design 47 G §379, §308.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 10:56:59 +01:00
jschoubben 90b8ba6461 CT10: the client meshpipelinerunnerclient: the runner's event subjects built and parsed, its bodies decoded
Builds: design 47 G §73, §74, §332 (every subject built and parsed back; group-ended
under branch and group with no module part). The rule Passed of the dev branch is not
built: no line of the contracts part names it.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 10:50:30 +01:00
jschoubben 72ac9b09cb CT11: regenerate the Go and TypeScript contracts from CT1 to CT9; each TypeScript contract as index.js with index.d.ts
Generated by seatgen (mesh-catalog, GEN1 and GEN2 on its worktree) from the
definitions of CT1 to CT9; module.json names the artifacts of the new seats
mesh-builds, mesh-pipeline-runner and git. seatgen -check is clean; every seat
package's generated fixture test passes.

Builds: design 47 G §341 (a TypeScript contract is emitted as index.js with
index.d.ts), §196, §339 (the generator refuses an unknown callers entry),
§260, §331.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 10:48:56 +01:00
jschoubben 15c065d2bb CT8: the seat mesh-delivery-checker: the events owed per repository and number, and checked
Builds: design 47 G §162, §164, §260 (owed on mesh.seat.mesh-delivery-checker.event.owed.<repository>.<number>, kept 7 days and 64 MiB per §396; checked).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 10:47:35 +01:00
jschoubben 71afa10f4d CT7: the seat mesh-delivery: source, recovery, groups with acts, owed and the record events; table, recheck, close and the milestone events removed
Builds: design 47 G §304, §305 (verbs source with a branch, recovery; groups; events
owed, pinned, freed, heads-replaced, record-opened, record-ended, filling, full, room,
source-moved, recovery-merged; table, recheck, close and the three milestone events
removed), §15, §162 (owed per repository and number, 7 days, 64 MiB), §431 (asks,
turns and the five verbs of release 6, checks and settle leave the definition),
§394 (recovery is of class act: the operator and sessions), §391 (class).

Open, left as the dev branch built it: the state merges is kept (no line says the
merge states of the gate go whole).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 10:47:13 +01:00
jschoubben 0c37cd6402 CT6: the seat git: its verbs with callers and error answers, tag, its events with hyphens, branch-moved kept
Builds: design 47 G §310, §311, §312 (an error answer fixture per verb), §313
(status, comment, view, note the forge bridge alone; merge-pull persons and
sessions; the reads invokers), §370 (tag, callers the builder), §396 (event names
with hyphens), §331 (branch-moved 64 MiB, 90 days), §11, §39 (state failed-steps),
§129, §111 (statuses, status), §391 (class).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 10:46:26 +01:00
jschoubben cbaa9a35e9 CT4: the seat mesh-wants: input, version-delivered, the accepted step, the want's version and parts, the step place
Builds: design 47 G §308, §22, §24, §116, §338 (accepted kind step from the runner
alone; step-ended.<node>), §331 (step-ended 32 MiB, version-delivered 64 MiB, 90
days), §376, §379 (version-delivered; the want names the released version and each
part's digest), §354 (verb input, callers the holders of the build seats; state
inputs), §184 (assignment revision per watched branch), §398 (the step place
declared here), §400 (no verb optional).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 10:45:40 +01:00
jschoubben 17517b9f4e CT5: the build seats' accepted kinds step and run, and the state detected-steps
Builds: design 47 G §22, §338 (accepted kinds step, runner alone; run, node-build-go,
callers the runner, the indexer, the assigner and the checker), §326, §414 (state
detected-steps, one key per artifact, apart from today's step keys steps).

Not built: §415's kind names check.step, check.run, delivery.step (the definition
reader refuses a dotted accepted-kind name); stopped on that question.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 10:44:58 +01:00
jschoubben 6acad9425d CT9: the registry seats' text callers become lists of the forms of §336
Builds: design 47 G §68, §127, §336, §392 (seat:<seat>, invokers).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 10:44:02 +01:00
jschoubben 94f8d3a48c CT5: the build seats: steps, drop, kept-artifact with callers, step-ended on the node, the accepted step
Builds: design 47 G §22, §116, §206, §271, §326, §338 (callers: steps the runner
and the indexer, drop the runner and the builder, kept-artifact the node-engines),
§24, §331 (step-ended.<node>, 128 MiB), §370, §373 (the ask carries the version and
each package member's digest), §203, §324 (acts build on the language).

Not yet in this commit, left as the dev branch built them and not read against the
lines: the accepted kind names (dev's 'step'; G-9 §415 names check.step, check.run,
delivery.step), the state rename detected-steps (G-9 §414).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 10:44:02 +01:00
jschoubben c8b11baf04 CT3: the seat mesh-catalog: registrations, versions, outdated, input, entry, version-released, versions-filled, entries with languages
Definition and fixtures; the generated contracts come with CT11 (their fixture
test is the proof: it fails on a fixture the definition does not read).

Builds: design 47 G §2, §3, §4, §100, §108, §394 (registrations read; register,
policy, watch, unwatch act, callers operator and sessions), §349, §372, §375,
§354, §443 (versions, outdated, input, entry; version-released, versions-filled
with no age limit; layouts versions, build-edges, inputs), §307, §260
(catalog-revision.<branch>), §47, §323, §365, §374, §378 (entry: artifacts with
language, edges with stale/order, word and part, the events the streams declare),
§331, §396 (keep objects), §400 (no verb optional), §391 (class).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 10:44:02 +01:00
jschoubben 7f0fbf15ae CT2: the seat mesh-builds, held once for the mesh: package-published, toolchain-agreed, reserved
Definition and fixtures; the generated contracts come with CT11.

Builds: design 47 G §52, §307 (seat held once, event package-published), §334
(artifact reference, version, digest, branch, source revision), §374 (resolved
dependencies with version and digest), §376 (toolchain-agreed: language, version,
toolchain digest), §369 (verb reserved, callers the registry seats' holders),
§331, §396 (keep: package-published 128 MiB, toolchain-agreed 16 MiB, 90 days),
§391 (class read).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 10:35:25 +01:00
jschoubben 04270ef754 CT1: the seat mesh-pipeline-runner, its twelve verbs with callers and class, its kept events and acts
Definition and fixtures only: the generated Go and TypeScript contracts and the
module.json artifacts come with CT11, once the reader of G-9's forms and the
generator read them (seatgen refuses these forms today).

Builds: design 47 G §306, §394, §391 (verbs, callers, class), §73, §332 (event
subjects; group-ended under branch and group), §331, §396 (each event's keep
object: 90 days and its cap), §65, §203, §266 (acts pipeline, bound 30m), §261
(fixtures name each subject), §419 (pipeline-ended: tests, over-budget yes/no),
§441 (widens says could not run).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 10:34:52 +01:00
jschoubben fcfaa41348 The grants part takes a first view of every binding from the seat mesh-broker's list
At each start and on grants_first_view_again with state bindings, the part asks
list, writes the bindings the answer carries that it holds none of or another of,
keeps and raises binding-unlisted for those the answer omits, never writes over
an event heard since the ask, holds the seat's events until the answer or the
bound, and raises first-view-unanswered naming mesh-broker and list past two
minutes while composing as before. grants_first_views shows the first view
beside the others. Cases are rows and subtests of the existing tests.

Builds: design 25 bindings-first-view §1, §3, §4, §5, §6, §7, §8 (hq d0760629, PR 543)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-11 10:30:22 +01:00
mesh-tools 532e4d740f Merge pull request 'A take-in wait ends whoever learnt of it: taken under every key, and the watchman's seed ends what the indexer no longer holds (issue 1966)' (#202) from fix/1966-take-in-ends-every-wait into main 2026-11-10 22:50:33 +00:00
jschoubben e82da39d29 Test that a seed indexer_pending could not answer ends nothing (issue 1966, note 197)
mesh/delivery merged: source.main moved to novox/mesh-delivery@532e4d740fdd
mesh/check checking e82da39d2999 on 532e4d740fdd
seedTakeIn with a failing call and with an unreadable answer leaves a previous run's take-in-waits finding
and a held wait standing; it fails if the error path seeded an empty answer.

Builds: design 47 "Taken in by the indexer it names" (A wait is bounded, said and recoverable); 1966/AC195-5

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 23:48:45 +01:00
jschoubben 3ed2a3dd33 The indexer says take-in.taken under every claimed entry's own key too (issue 1966, note 195)
A merge waiting behind a gathered group is named by indexer_pending under its own key; when the
group ends it joins the group's revision under the oldest member's key, so its own key was never
said taken. takenWaits now also says every claimed entry's key, no key twice. T8 checks the merge
behind the group ends under its own key.

Builds: design 47 "Taken in by the indexer it names" (A wait is bounded, said and recoverable); 1966/AC195-1, AC195-3

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 23:45:52 +01:00
jschoubben 393f69f766 The watchman's seed ends the waits and findings indexer_pending no longer names (issue 1966, note 195)
SeedTakeIn, run once indexer_pending answered and after the findings of a previous run were read,
ends every take-in wait, held wait and take-in-waits finding whose key the answer does not name, as a
take-in.taken would. A seed that could not ask is not run, so ends nothing.

Builds: design 47 "Taken in by the indexer it names" (A wait is bounded, said and recoverable: "At its start the watchman seeds its open waits from indexer_pending, and ends every take-in wait and take-in-waits finding it holds whose key indexer_pending no longer names"); 1966/AC195-5

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 23:45:52 +01:00
jschoubben c2e466e16c The indexer says take-in.taken for every wait indexer_pending names (issue 1966, note 195)
A merge taken in with no take-in.pending said for it (read from indexer_pending at a
watchman restart, or said pending by the own-build-unknown path) ended with no taken
event, so the watchman raised take-in-waits for a wait nothing held. takeInWholeBy now
says taken for each wait WaitsOf names for the claimed entries (a revision by its oldest
merge's key, a group by its g. key) as well as for its said waits, without saying a key
twice. Drops are unchanged.

Builds: design 47 "Taken in by the indexer it names" (A wait is bounded, said and recoverable); 1966/AC195-1, AC195-2, AC195-3, AC195-4

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 23:45:46 +01:00
mesh-tools a6bba2af80 Merge pull request 'The assigner's wants step proves a restatement heard while an ask runs is asked once more (issue 1966 note 170; group with mesh-contracts)' (#201) from fix/1966-engine-reads-asked-again into main 2026-11-10 10:45:52 +00:00
jschoubben 1a6144aa35 S4: the assigner's wants step proves a restatement heard while ace's ask runs is asked once more (issue 1966 note 170)
mesh/delivery merged: source.main moved to novox/mesh-delivery@a6bba2af808c
mesh/delivery-group group fix/1966-engine-reads-asked-again merged: every member is merged
mesh/check checking 1a6144aa352b on a6bba2af808c | novox/mesh-delivery#201 in group fix/1966-engine-reads-asked-again
1966/AC170-4: in TestWantsAreWrittenAndNoDifferenceIs, ace's engine's answer is held
while it restates with a new form and says manifest-reads-changed again; the
restatement's event is asked once more after the held ask (the journal line), the
state engine-reads ends at the restatement with its event-at, and the held want moves.
Against the node-engine seat's client on trunk the step fails: the event is dropped.
A step in the existing test, no new function (the repository is over its test budget);
the bed hands the program a journal the test awaits a line in, no sleep.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 11:36:02 +01:00
mesh-tools 7ba8449ff6 Merge pull request 'Assigner: a backup ask whose want moved on is stale, and an ended ask is not written again when stale (issue 1966 note 165)' (#200) from fix/1966-stale-ended-ask into main 2026-11-10 10:05:06 +00:00
jschoubben 3841a95068 Assigner: the backup row proves the ask and its condition go with the move (issue 1966 note 165, review round 1)
mesh/delivery merged: source.main moved to novox/mesh-delivery@7ba8449ff67c
mesh/check checking 3841a950685b on 7ba8449ff67c
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 11:01:56 +01:00
jschoubben 1d654b286d Assigner: a backup ask whose want moved on is stale; an ended ask is not written again when stale (issue 1966 note 165, ADR 0668 §4)
The pass takes a backup ask away when its module's want on the node names another fingerprint or is removed, and clears its condition; askAgain asks the pass's staleAsk first for the event and the bind read. The hand tool is left as it is.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 10:52:57 +01:00
mesh-tools ee3906bb19 Merge pull request 'Kept calls in the assigner, teller, builder and indexer; take-in judges what it writes; hand tools for each recovery (ADR 0668; issue 1966; group fix/1966-call-made-once)' (#199) from fix/1966-call-made-once into main 2026-11-10 07:20:35 +00:00
jschoubben 262d21c431 D14: the assigner keeps its manifest-reads wait through the node-engine seat's client's ReadsCalls, its own copy gone (issue 1966, ADR 0668 §3, ADR 0634 §1; review round 3, finding 2)
mesh/delivery-group group fix/1966-call-made-once merged: every member is merged
mesh/delivery merged: source.main moved to novox/mesh-delivery@ee3906bb19ba
mesh/check checking 262d21c431b3 on ee3906bb19ba | novox/mesh-delivery#199 in group fix/1966-call-made-once
Its presence says heard at each pass, so it keeps no bound; the findings it holds from an earlier process are weighed through Held.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 05:01:15 +01:00
jschoubben 98ffc1fb80 D13: the builder and the indexer ask the watchdogs seat's presence when a manifest-reads call's bound ends, through the node-engine seat's client's ReadsCalls, and read no watchman state (issue 1966, ADR 0596 §2, ADR 0668 §3, ADR 0634 §1; review round 3, findings 1 and 2)
Both manifests drop the read mesh-delivery-watchman.presence and invoke seat:mesh-watchdogs.presence; buildrun's ReadsCalls, its presence bucket and both watchPresence copies go. The machine is asked once when the bound key expires; a node that returns is asked again on manifest-reads-changed, and the finding clears on its answer. The indexer's finding is stamped with the wait's clock.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 05:01:15 +01:00
jschoubben 8e426b236d D12: the watchman serves the watchdogs seat's presence with its declared machine, answering that machine's online and since in the seat's answer (issue 1966, ADR 0596 §2; review round 3, finding 1)
The builder and the indexer ask it whether a node's machine is heard instead of reading the watchman's state; key and prefix stay for the whole read.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 04:55:31 +01:00
jschoubben 0f52bb80ad D11: the builder and the indexer say a manifest-reads call unanswered past five minutes, its machine heard, as call-unanswered in their own findings (issue 1966, ADR 0668 §3; review round 2)
Both write it through buildrun.ReadsCalls over enginereads Keeper.Unanswered as the assigner does, read the watchman's presence for a machine heard, arm a bound key that expires at the five minutes (no timer) and clear the finding when the node answers or its machine is away.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 04:38:38 +01:00
jschoubben 00e84bb977 D10: the assigner calls the operator-channel seat's asks with its declared input and reads its declared answer (issue 1966, ADR 0668 §4; review round 1, finding 5)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 04:20:04 +01:00
jschoubben 23ddaa8bed D9: the assigner keeps the wait of its bind's asks read and of a heard node's manifest-reads, and says each unanswered past five minutes as call-unanswered (issue 1966, ADR 0668 §3; review round 1, finding 4)
The bind's read of the operator channel's asks is made again after every transport fault until answered; a node whose engine answers nothing while its machine is heard is asked again at each pass once its ask ended. Past CallUnansweredAfter with the callee's machine heard each writes the finding in the assigner's findings, cleared once answered; none while the machine is away.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 04:17:45 +01:00
jschoubben 8f50f22622 D8: a trunk's held manifest judged by its digest is said as manifest-accepted or manifest-refused, as the full pass says it (issue 1966, ADR 0668 §4; review round 1, finding 3)
indexer_judge with a digest and the start pass's judgeStale wrote the verdict and said nothing, so a part waiting on manifest-accepted never heard it.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 04:13:02 +01:00
jschoubben cddaf14cd0 D7a: the assigner, the indexer and the builder ask a node's manifest-reads once before the kept call, so a node that answers nothing reads as its fallback at once (issue 1966, ADR 0668 §3; review round 1, finding 1)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 04:11:07 +01:00
jschoubben bd39747c22 D1i: a row for the indexer's bind: every counted node's manifest-reads is called once (issue 1966 note 155, ADR 0668 §4)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 03:53:05 +01:00
jschoubben 17dd41696c D4f: a merged message still unread five minutes on, the forge heard, is the indexer's finding call-unanswered (issue 1966 note 153, ADR 0668 §3)
A message heard on the forge is the forge bridge heard, the callee of the call:
after each one a merge unread since CallUnansweredAfter or longer writes the
finding naming the bridge's call, and a merge no longer unread clears it. While
nothing is heard on the forge (the bridge's machine away) no finding is written;
the merge is read again when the forge is heard. No timer.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 03:52:04 +01:00
jschoubben 7b3f213ae8 D6i: a merge taken in before the verdicts state binds has each manifest judged as new and said at the bind, in the indexer's whole-module test (issue 1966 note 154, ADR 0668 §4)
Without the unjudged state the bind's pass accepted the refused manifest with a
warning and the waiting one, and said manifest-accepted for both; the row settles
Q3: the indexer says what grants follows, so the grants part is unchanged (no D8).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 03:48:21 +01:00
jschoubben b48e9ca6ce D6k: keep a take-in's new manifests unjudged on the bus until a judge pass judges them (issue 1966, ADR 0668 §4)
A judge pass that failed lost the set of manifests the take-in newly wrote, which
lived only in its memory: the next pass found no verdict, took each as accepted
before any verdict (ADR 0579 §1), and wrote a refusal as a warning. The take-in
now keeps each new digest in the indexer's own state unjudged before it writes
the module naming it; every judge pass judges those as fresh and ends a key once
its verdict is written or no module holds it. indexer_read_unjudged reads the
state; indexer_judge judges it again by hand.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 03:46:09 +01:00
jschoubben 9296db5538 D6: a take-in waits for the verdicts state, so every manifest it writes is judged in it before take-in.taken; its bind evaluates pending again (issue 1966 note 154, ADR 0668 §4)
A take-in whose judge pass fails is judged again at the next message heard, as a failed start pass is.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 03:38:07 +01:00
jschoubben d3f68c5372 D5: indexer_drop_pending counts a later pending merge as covering only when its commit has the pending merge's as an ancestor (issue 1966, ADR 0668 §6, ADR 0633 §5)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 03:34:57 +01:00
jschoubben e4dabdbc7a D7: a build key a look left building because its end could not be written is call-unanswered after five minutes (issue 1966, 1748 note 27, ADR 0668 §3, §5)
The look arms a key of the state bounds with its own time to live; the bus's marker of its end raises call-unanswered
about the build key while it is still building and no look holds it, naming builder_build_again; the key's next written
end deletes the bound and clears the finding. A bound that cannot be written raises at once. No timer.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 03:34:57 +01:00
jschoubben 0d16381b28 D7: the builder's ask put is a kept call, a put or note a transport fault kept from the key fails it in that fault's words, and builder_build_again takes a key left building (issue 1966, 1748 note 27, ADR 0668 §1, §2, §5)
The put carries the ask's id as its message id, so it is made again through a deadline and no responders within the bound;
a put or a note that still meets one fails the key as a transport fault, which the builder does not retake by itself
(ADR 0664 §3) and the hand tool does. A key left building with no look holding it (its end never written: "claimed", no
ask) is taken as it stands by builder_build_again, from another builder too.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 03:30:37 +01:00
jschoubben 3076aabbe0 D3: the teller keeps an assigner ask whose publish failed waiting, and asks it at the next end and at its start (issue 1966, ADR 0668 §1)
A failed publish deleted the kept record for "the next writing of the key", which nothing made.
The ask now joins the teller's wait for room, kept on the bus, which asks again at the next end
and at the start. The gate's asks are left as they are (ADR 0666 §6 replaces them).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 03:17:50 +01:00
jschoubben f02a740b10 D2: assigner_ask_again asks one of the assigner's asks of the operator again by hand (issue 1966, ADR 0668 §5)
The recovery of an ask that ended at the channel unheard needed a restart. The tool writes the key
again under a new asking by the ask-ended rules (a proposal's authorising ask and a put's record ask
are refused), refuses an asking the operator answered, naming the answer, and records the hand act
through the seat mesh-hand-acts. One tool added to the manifest.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 03:16:28 +01:00
jschoubben c3b240bdfa D4: a merged message the forge bridge could not give for a transport fault is unread, not lost, and read again on the next message heard on the forge (issue 1966 note 153, ADR 0668 §1, §4)
The indexer's call for a merged message is a kept call (CallKept). A load that met a deadline or no
responders keeps the entry as unread (Pending.Unread, indexer_pending's unread), with a line that
names the read again rather than a drop; after every message heard on FORGE, of any kind, an unread
merge is evaluated again. The bridge's own answer stays lost. indexer_take_in_pending already reads
the message again (Q8).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 03:14:12 +01:00
jschoubben 3f2482716b Q7: the assigner reads the operator-channel seat's asks at its consumer's bind and asks again each held asking that lapsed or was cancelled (issue 1966, ADR 0668 §4)
An ask-ended the teller said before the assigner's consumer existed is not delivered to it (note 155).
At each bind the assigner calls the seat verb operator-channel.asks once, a kept call, for the ended
asks since its earliest held asking, and writes again each one that ended expired or cancelled, by
the ask-ended rules and their compare-and-set. A seat verb: no module named. One invoke added.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 03:10:33 +01:00
jschoubben 7bdc41c0d3 D5: indexer_drop_pending refuses a merge no later merge covers, unless abandon (issue 1966, ADR 0633 §5, ADR 0668 §5)
#650, its repository's head, was dropped on the advice of a line that named a drop where nothing
covered it; its changes would never have been taken in. The rule lived only in the record and the
advice; the tool now checks it, and the advice names the read again.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 03:01:38 +01:00
jschoubben 416e270899 D1: the assigner, builder and indexer call every node's manifest-reads again at their consumer's bind (issue 1966, ADR 0668 §4)
Note 155: a manifest-reads-changed said before the assigner's consumer existed was never heard, and
ace's bootstrapped statement stood. Each part registers the engine-reads keeper's AtBind on its hub
and calls the verb as a kept call (CallKeptOn). The asks-at-bind half (Q7) is not in this commit.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 02:59:53 +01:00
mesh-tools 1fad9c8855 Merge pull request 'An assigner ask that ends at the channel without an answer is asked again under a new asking (issue 1966)' (#198) from fix/1966-ask-ended into main 2026-11-10 00:44:42 +00:00
mesh-tools 8d9683d844 Merge pull request 'The assigner's and the grants part's seat-list again answers the operator's sessions (issue 1966; group fix/1966-seat-list-unread)' (#197) from fix/1966-seat-list-unread into main 2026-11-10 00:44:38 +00:00
jschoubben 77f5ec7d4f Subtask C: tellerevents' own test goes, its rows are the assigner's ended-ask rows and the teller's decode of every event said, to stay within the test budget (issue 1966)
mesh/delivery merged: source.main moved to novox/mesh-delivery@1fad9c8855a8
mesh/check checking 77f5ec7d4f0a on 8d9683d844ec
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 01:10:41 +01:00
jschoubben 46badf078e Subtask A: the assigner hears the teller's ask-ended and writes the ask again under a new asking (issue 1966)
An ask that ended at the operator channel without an answer while its key stood was never
written again, so nothing asked it (note 151: the nats yes on novox, three backup asks). The
assigner now consumes mesh-delivery-teller.ask-ended on its durable consumer and writes the key
again by compare-and-set under AskingSeconds (above the old asking), an id of its own and a new
expiry (AskLasts), one row per kind: hold, restore, backup and a record ask of the rules are
written again; the authorising ask of a proposal is not (ADR 0567 §5, §11: its lapse ends the
proposal, again asks it again), nor a record ask a put asked (ADR 0546: its lapse refuses the
put), nor an asking the key no longer holds.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 01:10:35 +01:00
jschoubben b39b0771a0 Subtask T: the teller says an assigner ask that ended at the channel without an answer as its event ask-ended (issue 1966)
An assigner ask that lapsed or was cancelled at the operator channel while its key still stands
was never asked again: the router drops a second ask under an id it keeps, and the assigner
only writes a new asking when the key is absent (note 151: the nats yes on novox and three
backup asks). The teller now says ask-ended (its module event, emits; body in its own package
tellerevents, ADR 0634 §1) when the router records such an end, and when a watch hands it a key
standing under an asking that ended so, which covers its start and the asks standing now. A
refusal, a replacement, an answer and an end by hand (teller_end_ask, kept in its own record)
are not said.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 01:07:05 +01:00
jschoubben b1343147e8 S7: the assigner's and the grants part's seat-list again answers a proved operator's session
mesh/delivery merged: source.main moved to novox/mesh-delivery@8d9683d844ec
mesh/delivery-group group fix/1966-seat-list-unread merged: every member is merged
mesh/check checking b1343147e80f on 8d9683d844ec | novox/mesh-delivery#197 in group fix/1966-seat-list-unread
Their seat_list_again answered person.<name> and the healers, but every call
through the mesh MCP server is proved as its machine's tool runner (issue
627), so no operator's session could ask it; node-tools now stands for that
session, the kind met a second time in the node-engine (issue 1966). The
assigner's silent stand-in keeps the bus's retry bound short, since the
seat list's reader now asks again while its ask reached no one.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-10 00:59:07 +01:00
mesh-tools 8b03cc036e Merge pull request 'A build step's run that meets a transport fault is again; the asker waits through it and drops what it withdraws (issue 1748; group fix/1748-transport-retry)' (#196) from fix/1748-transport-retry into main 2026-11-09 22:58:32 +00:00
jschoubben 7e0634205a R2: a row holds the build seats' work queues above three deliveries and at most ten (ADR 0664 §2, ADR 0436 §6, issue 1748 review 2)
mesh/delivery merged: source.main moved to novox/mesh-delivery@8b03cc036ec7
mesh/delivery-group group fix/1748-transport-retry merged: every member is merged
mesh/check checking 7e0634205aa4 on 8b03cc036ec7 | novox/mesh-delivery#196 in group fix/1748-transport-retry
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 23:55:13 +01:00
jschoubben a8c8f8fb5a F8, dropped: the Drop layout is the generated contracts' (not the domain SDK's) and the key form sits beside Pause's helpers; a step ended by drop is the state dropped (ADR 0664 §4, issue 1748 review 1)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 23:40:29 +01:00
jschoubben 9e00300860 F4: the builder's own retake holds a key that failed on a transport fault; a hand act or a builder that starts takes it (ADR 0664 §3, issue 1748 review 1)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 23:38:48 +01:00
jschoubben 68fedded8c F1, F7: the asker drops an ask only on a withdrawal cause (superseded, taken out, asked again by hand), not on the check bound; the checker's drop on Forget is asserted; a step's own run count and a failed drop are said (ADR 0664 §4, issue 1748 review 1)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 23:37:51 +01:00
jschoubben 82f0f6a134 F6a: network is unreachable and no route to host are transport words (issue 1748 review 1)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 23:33:15 +01:00
jschoubben fe6552ba7c D4b: the asker calls the build seat's drop on whichever holder answers, no node named, and for an ask no node took (ADR 0664 §4, §5, issue 1748)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 23:18:15 +01:00
jschoubben c072a271e5 D4b: a row that a candidate taken out ends its check with a named cause, so the asker drops its asks (ADR 0664 §5, issue 1748)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 23:17:05 +01:00
jschoubben 8195da08e8 D2c: PassingCause knows git's could-not-resolve-host and a client's timeout (ADR 0664 §1, issue 1748)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 23:10:16 +01:00
mesh-tools 10066c5ec0 Merge pull request 'An answered ask is kept until its yes is in the want, and an ask taken away is asked again under a new asking (issue 1966)' (#195) from fix/1966-record-ask-lost into main 2026-11-09 22:08:39 +00:00
mesh-tools 1e21adfde2 Merge pull request 'The delivery view names a lagging node's builds by fingerprint and what moved, and says a failed build as failed (issue 1966)' (#194) from fix/1966-view-names-builds into main 2026-11-09 22:08:22 +00:00
jschoubben e22f75ac7a D2b: DropKey and DroppedPrefix name the key of an ask's drop (ADR 0664 §5, issue 1748)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 23:05:37 +01:00
jschoubben c09d0f9c6d D5: checker_ask_again takes a failed verdict whose failing steps all ended on a transport fault (ADR 0664, operator answer 5, issue 1748)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 23:03:28 +01:00
jschoubben cc1c0c5d94 D4b: the asker drops an ask it stops waiting for on the node that last ran it: given again past its bound, or a named cause (ADR 0664 §5, issue 1748)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 23:01:54 +01:00
jschoubben bfc73581ec D4: builder_seat_queue counts a step given again as waiting; a failure on a transport fault is built again as a new revision (ADR 0664, issue 1748)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 22:59:50 +01:00
jschoubben 397d2d120a D4 (part): the builder says each run that ended on a transport fault, in its log and on its key's step (ADR 0664 §3, issue 1748)
builder_seat_queue listing asks waiting to be given again, and the claim row for a FailedUntilChanged key, are left for D4's rest.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 22:58:12 +01:00
jschoubben eed1738d8f D3: readers of whether an ask ended use Ended; the asker waits through a step given again and says a transport fault on N runs (ADR 0664 §3, issue 1748)
Shared lines for the join with milestone G: mesh-delivery-checker internal/check/read.go (one line), mesh-delivery-builder buildrun/asks.go.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 22:57:10 +01:00
jschoubben 85cf4712fc Put the lagging-build rows into the existing reach test, and word a build that is not the newest as the build the node waits for (issue 1966)
mesh/delivery merged: source.main moved to novox/mesh-delivery@1e21adfde221
mesh/check checking 85cf4712fc59 on 10066c5ec0c0
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 22:56:28 +01:00
jschoubben 8596b9abf5 Subtask C: the two new tests of issue 1966 run inside existing test functions, to stay within the test budget
mesh/delivery merged: source.main moved to novox/mesh-delivery@10066c5ec0c0
mesh/check checking 8596b9abf52c on 10066c5ec0c0
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 22:55:58 +01:00
jschoubben bfbdaf34ea D2: the domain SDK names the state again, Ended, Passing, PassingCause, HolderSilent, AgainAfter and Drop (ADR 0664 §1, §2, issue 1748)
Shared line for the join with milestone G: sdk/buildstep/ask.go (AgainAfter beside AskRuns).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 22:55:34 +01:00
jschoubben 440d02afb3 D1: the build step part gains the state again, run, again-at, passing and the verb drop; the three build seats regenerated (ADR 0664 §1, §4, issue 1748)
Shared lines for the join with milestone G: contracts/parts/build-step.json, the three seats' fixtures and generated contract files.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 22:54:42 +01:00
jschoubben 5ab0d8ca88 Subtask B: the teller says an assigner ask written again under the id the router kept is not asked, with a row per kind that a new asking is asked again (issue 1966)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 22:48:02 +01:00
jschoubben 2469531c2f Subtask A: a record ask is kept while its node waits on it or its yes is unwritten, and an ask written again is asked again under a new id (issue 1966)
The assigner took record.novox.nats away as stale in the same second the operator's yes
was written (the yes counts only while the ask is there), and rewrote it under the id the
router already kept, so the teller never asked it again. The stale test compared a module's
ask with the whole node's composition; it now reads the module's own have, and restore and
record asks are numbered by their writing's time as hold asks are.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 22:47:32 +01:00
jschoubben 47026d5ebb The view says a lagging node's build by fingerprint, what moved, and a failed newest build (issue 1966)
The hold named the same commit twice when only a mesh package moved. It now names both builds
by fingerprint with their commits, the input that moved when the commit is the same, and says a
newest build that failed as failed with its first words.

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 22:41:22 +01:00
mesh-tools 29e491e715 Merge pull request 'The manifest validator refuses a catch-up tool the module does not declare' (#193) from fix/manifest-form-reader into main 2026-11-09 21:27:40 +00:00
jschoubben e7415c1812 The judge refuses a catch-up tool the module does not declare (design 47)
mesh/delivery merged: source.main moved to novox/mesh-delivery@29e491e715ba
mesh/delivery-group group fix/manifest-form-reader merged: every member is merged
mesh/check checking e7415c1812be on 29e491e715ba | novox/mesh-delivery#193 in group fix/manifest-form-reader
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 21:20:48 +01:00
jschoubben 460f3caf38 Judge tests quote the reader's refusal naming form and catch-up
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 21:16:33 +01:00
jschoubben 38031571c1 The judge accepts a kept data's form and catch-up tool as the reader now reads them (design 47)
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 21:11:49 +01:00
mesh-tools 05e21fd8a3 Merge pull request 'A put without a hold ends once the node runs its fingerprint healthy' (#192) from fix/1966-put-ends into main 2026-11-09 19:37:53 +00:00
jschoubben b71358e2cc A put without a hold ends once the node runs its fingerprint healthy, and assigner_puts says a put older than the newest build
mesh/delivery merged: source.main moved to novox/mesh-delivery@05e21fd8a382
mesh/check being carried to b71358e2cc14 on 05e21fd8a382 | from fc21f2d1bd56
A put with hold false waited for the node's composition digest to equal its own and never ended when the node composes its own,
pinning the module's want (issue 1966, F21).

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
2026-11-09 19:54:16 +01:00
mesh-tools fc21f2d1bd Merge pull request 'The checker keeps a composition request in pieces and packs it in the compose ask (issue 1966, recovery; group with mesh-catalog)' (#189) from fix/1966-checker-compositions-objects into main 2026-11-09 16:31:25 +00:00
jschoubben bf7540cd9e The build step part's request names both forms; the three build seats' contracts regenerated (issue 1966)
mesh/delivery merged: source.main moved to novox/mesh-delivery@fc21f2d1bd56
mesh/delivery-group group fix/1966-checker-compositions-objects merged: every member is merged
mesh/check checking bf7540cd9ec2 on fc21f2d1bd56 | novox/mesh-delivery#189 in group fix/1966-checker-compositions-objects
The compose job's `request` description now says it is the request object or the JSON string "gzip+base64:" followed by the
base64 of the gzip-compressed object, as ADR 0634 §1 puts a seat's messages in its contract. The field stays `any`;
seatgen regenerated node-build-go, node-build-node and node-build-image (Go and TypeScript), and its -check is clean.
ask.go's comment says the checker packs every request it sends.

Delivery: an old holder of node-build-go refuses the packed ask loudly (it holds no request object) until it runs the new
mesh-build-go; the checker is built by mesh-build-go after it (module graph edge), and every check composing ace or novox
fails today anyway.

Claude-Session: https://claude.ai/code/session_01NcbgfFfQ4Z9UE5jK32PmE5
2026-11-09 16:41:56 +01:00
jschoubben 173c49fc87 The compose ask carries its request gzip-packed; requests of another version are refused by name (issue 1966)
A large node's request is 1.2 MB, over the bus's 1 MiB message limit, so the compose ask failed once keeping no longer did.
The checker packs the request (a JSON string "gzip+base64:..." in the part's `any` request, no contract change) and
buildstep.ComposeJob.RequestBytes reads either form. A kept request of another version is refused naming it, and listing
no longer reads pieces. An older mesh-build-go refuses a packed ask loudly (it holds no request object): the check fails
naming it, so the catalog change is delivered with this one as a group.

Quick fix (chosen as the recovery): pack the request, ~290 KB for the largest node. Thorough fix (milestone G): the request
named by digest and served on a seat verb, as RunInput is.

Claude-Session: https://claude.ai/code/session_01NcbgfFfQ4Z9UE5jK32PmE5
2026-11-09 16:41:56 +01:00
jschoubben 3f1d9cecba Checker keeps a composition request in pieces, each under the state's value limit (issue 1966)
mesh-host #219's check failed: the request kept for g14 was 300127 bytes compressed, over the 262144 the state takes.
The key of the check and node now holds a pointer (digest, size, pieces) and each piece of the gzip bytes is a value of
its own under pieces/<digest>/<i>, at most 128 KiB; checker_composition_requests follows the pointer and checks the digest.

Quick fix: a larger cap or a better compression: still a limit, met again as the mesh grows. Thorough fix (chosen, and
bounded only by the bucket): pieces. Not an object store: the checker is a foundation part, whose data stays in the old
sections (ADR 0619 §2), and the tool runner serves no old-section object read to its tools. No manifest change.

Claude-Session: https://claude.ai/code/session_01NcbgfFfQ4Z9UE5jK32PmE5
2026-11-09 16:41:56 +01:00
mesh-tools a072d60cae Merge pull request 'The indexer writes no fingerprint from a packages state it did not read, and computes fingerprints again by hand (issue 1966, recovery)' (#191) from fix/1966-indexer-packages-read into main 2026-11-09 14:48:20 +00:00
jschoubben efdfe1f755 A bucket the bus cannot reach is its error, not nothing published; only a bucket not found is not yet (issue 1966, review round 3)
mesh/delivery merged: source.main moved to novox/mesh-delivery@a072d60cae1d
mesh/check checking efdfe1f75518 on a072d60cae1d
Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
2026-11-09 15:43:52 +01:00
jschoubben 9073190646 A packages state not on the bus yet is nothing published, not a failed read (issue 1966, check of #191)
Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
2026-11-09 15:40:44 +01:00
jschoubben 3a63813b3d Fingerprints computed again by hand run a merge's recompute; the tests join existing ones (issue 1966, review round 1)
mesh/delivery closed: a newer head of the same pull request
mesh/check failed (6): integration: mesh-delivery-indexer/cmd/mesh-delivery-indexer.TestIndexerWritesModule…; and 5 more | 3a63813b3d75 on fb69c8dee691
Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
2026-11-09 15:24:30 +01:00
jschoubben 03164e853e The indexer writes no fingerprint from a packages state it did not read, keeps no import form beside a version line, and computes fingerprints again by hand (issue 1966)
An indexer that started while the bus's storage was down read no published package,
took every import for unpublished and wrote the version line over ~130 modules'
fingerprints, which a later pass kept through the build's shortcut. A failed or empty
read of the packages state, where held modules were computed from published ones,
now fails the pass and says why; a version line clears the import form it was
computed beside; indexer_fingerprints_again computes the import form again by hand,
acting first and recording the hand act after, with a bound.

Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
2026-11-09 15:15:26 +01:00
jschoubben 2819b05838 The assigner's integration test answers the verbs' asks of the indexer's first views from the indexer's buckets (issue 1966)
The verbs ask mesh-delivery-indexer.modules and .manifests through the tool runner
since the asks moved off the indexer's state, but the test's stand-in answered every
ask {ok:true}, which is no answer: propose failed on main with 'unexpected end of
JSON input'.

Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
2026-11-09 15:10:32 +01:00
1439 changed files with 169535 additions and 27229 deletions
+6
View File
@@ -2,3 +2,9 @@ vendor/
# A compiled program never enters a commit (issue 1577): `go build .` in a command directory leaves one there.
modules/*/cmd/*/mesh-*
!modules/*/cmd/*/mesh-*.go
# `go build .` at a module's root leaves its program there too (the view's, met a second time).
modules/*/mesh-*
# The delivery SDK's commands (design 47 G §464), built in their own directory or at the SDK's root.
/modules/mesh-delivery-sdk/cmd/seatgen/seatgen
/modules/mesh-delivery-sdk/seatgen/seatgen
/modules/mesh-delivery-sdk/mesh-pack
+6 -71
View File
@@ -58,13 +58,12 @@ const SubjectManifestAccepted = "mesh.seat.mesh-catalog.event.manifest-accepted"
const SubjectManifestRefused = "mesh.seat.mesh-catalog.event.manifest-refused"
const (
StateManifests = "manifests"
StateModules = "modules"
StateCandidates = "candidates"
StateVerdicts = "verdicts"
StatePredefined = "predefined"
StateConfigCandidates = "config-candidates"
StatePackages = "packages"
StateManifests = "manifests"
StateModules = "modules"
StateCandidates = "candidates"
StateVerdicts = "verdicts"
StatePredefined = "predefined"
StatePackages = "packages"
)
// ManifestsByDigestKey is the key of one value of the state manifests under the form "<digest>".
@@ -221,37 +220,6 @@ func DecodePredefinedByListValue(raw []byte) (PredefinedByListValue, error) {
return v, nil
}
// ConfigCandidatesByPullKey is the key of one value of the state config-candidates under the form "<pull>".
func ConfigCandidatesByPullKey(pull string) string { return pull }
// ParseConfigCandidatesByPullKey reads the parts of a key of the form "<pull>", in the order of the form; the last result is false for a key of another form.
func ParseConfigCandidatesByPullKey(key string) (string, bool) {
rest := key
if rest == "" {
return "", false
}
v0 := rest
rest = ""
if rest != "" {
return "", false
}
return v0, true
}
// DecodeConfigCandidatesByPullValue reads one value of the state config-candidates under the form "<pull>", refusing a field ConfigCandidatesByPullValue does not know and any text after the value.
func DecodeConfigCandidatesByPullValue(raw []byte) (ConfigCandidatesByPullValue, error) {
var v ConfigCandidatesByPullValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
}
// PackagesByModuleKey is the key of one value of the state packages under the form "<module>".
func PackagesByModuleKey(module string) string { return module }
@@ -584,39 +552,6 @@ type PredefinedByListValue struct {
V int64 `json:"v,omitempty"`
}
// ConfigCandidatesByPullValueDeclaresValueValue is a type of the contract.
type ConfigCandidatesByPullValueDeclaresValueValue struct {
// the default
Default any `json:"default"`
Description string `json:"description,omitempty"`
// the allowed values
Enum any `json:"enum,omitempty"`
Kind string `json:"kind"`
// a declared bound; 0 is a bound, absent is none
Maximum *float64 `json:"maximum,omitempty"`
// a declared bound; 0 is a bound, absent is none
Minimum *float64 `json:"minimum,omitempty"`
Pattern string `json:"pattern,omitempty"`
Predefined string `json:"predefined,omitempty"`
Required bool `json:"required,omitempty"`
Runtime bool `json:"runtime,omitempty"`
Trusted bool `json:"trusted,omitempty"`
Type string `json:"type,omitempty"`
Why string `json:"why"`
}
// ConfigCandidatesByPullValue is one value of the state config-candidates under the key <pull>.
type ConfigCandidatesByPullValue struct {
// when (RFC 3339 time)
At *time.Time `json:"at,omitempty"`
// module to key to declaration
Declares map[string]map[string]ConfigCandidatesByPullValueDeclaresValueValue `json:"declares"`
Head string `json:"head"`
Pull string `json:"pull"`
// the layout version
V int64 `json:"v,omitempty"`
}
// PackagesByModuleValuePackagesItem is a type of the contract.
type PackagesByModuleValuePackagesItem struct {
Digest string `json:"digest"`
@@ -27,18 +27,6 @@ func TestFixtures(t *testing.T) {
decode: func(b []byte) (any, error) { var v VerdictsByDigestValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "the predefined list", subject: "", given: "{\"commit\":\"cccccccccccccccccccccccccccccccccccccccc\",\"list\":{\"streams\":[]},\"v\":1}", wire: "{\"commit\":\"cccccccccccccccccccccccccccccccccccccccc\",\"list\":{\"streams\":[]},\"v\":1}",
decode: func(b []byte) (any, error) { var v PredefinedByListValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "a pull request's configuration", subject: "", given: "{\"declares\":{\"nats\":{\"limit\":{\"default\":1,\"kind\":\"setting\",\"why\":\"a bound\"}}},\"head\":\"cccccccccccccccccccccccccccccccccccccccc\",\"pull\":\"novox/mesh-catalog#1\",\"v\":1}", wire: "{\"declares\":{\"nats\":{\"limit\":{\"default\":1,\"kind\":\"setting\",\"why\":\"a bound\"}}},\"head\":\"cccccccccccccccccccccccccccccccccccccccc\",\"pull\":\"novox/mesh-catalog#1\",\"v\":1}",
decode: func(b []byte) (any, error) {
var v ConfigCandidatesByPullValue
err := json.Unmarshal(b, &v)
return v, err
}, subjectIs: nil},
{name: "a pull request's configuration state whose bounds are declared 0 (a zero is a bound, not none)", subject: "", given: "{\"declares\":{\"nats\":{\"limit\":{\"default\":0,\"kind\":\"setting\",\"maximum\":0,\"minimum\":0,\"why\":\"a bound\"}}},\"head\":\"cccccccccccccccccccccccccccccccccccccccc\",\"pull\":\"novox/mesh-catalog#1\",\"v\":1}", wire: "{\"declares\":{\"nats\":{\"limit\":{\"default\":0,\"kind\":\"setting\",\"maximum\":0,\"minimum\":0,\"why\":\"a bound\"}}},\"head\":\"cccccccccccccccccccccccccccccccccccccccc\",\"pull\":\"novox/mesh-catalog#1\",\"v\":1}",
decode: func(b []byte) (any, error) {
var v ConfigCandidatesByPullValue
err := json.Unmarshal(b, &v)
return v, err
}, subjectIs: nil},
{name: "a published Go module", subject: "", given: "{\"commit\":\"cccccccccccccccccccccccccccccccccccccccc\",\"module\":\"git.novox.be/novox/mesh-sdk/go\",\"packages\":[{\"digest\":\"ab\",\"package\":\"git.novox.be/novox/mesh-sdk/go/keys\"}],\"repository\":\"novox/mesh-sdk\",\"v\":1}", wire: "{\"commit\":\"cccccccccccccccccccccccccccccccccccccccc\",\"module\":\"git.novox.be/novox/mesh-sdk/go\",\"packages\":[{\"digest\":\"ab\",\"package\":\"git.novox.be/novox/mesh-sdk/go/keys\"}],\"repository\":\"novox/mesh-sdk\",\"v\":1}",
decode: func(b []byte) (any, error) { var v PackagesByModuleValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "a package series", subject: "", given: "{\"name\":\"go-keys\",\"series\":\"0.1\",\"v\":1}", wire: "{\"name\":\"go-keys\",\"series\":\"0.1\",\"v\":1}",
+72 -4
View File
@@ -18,6 +18,7 @@ const (
VerbCurrent = "current"
VerbPause = "pause"
VerbResume = "resume"
VerbDrop = "drop"
)
const (
@@ -28,7 +29,7 @@ const (
// Verbs is every verb the seat serves, in its definition's order: a new copy each call.
func Verbs() []string {
return []string{VerbCurrent, VerbPause, VerbResume}
return []string{VerbCurrent, VerbPause, VerbResume, VerbDrop}
}
// AcceptSubjectDelivery is where delivery is sent.
@@ -117,6 +118,41 @@ func DecodePausesByPausedNodeValue(raw []byte) (PausesByPausedNodeValue, error)
return v, nil
}
// PausesByDroppedIDKey is the key of one value of the state pauses under the form "dropped.<id>".
func PausesByDroppedIDKey(id string) string { return "dropped." + id }
// ParsePausesByDroppedIDKey reads the parts of a key of the form "dropped.<id>", in the order of the form; the last result is false for a key of another form.
func ParsePausesByDroppedIDKey(key string) (string, bool) {
rest := key
if !strings.HasPrefix(rest, "dropped.") {
return "", false
}
rest = rest[8:]
if rest == "" {
return "", false
}
v1 := rest
rest = ""
if rest != "" {
return "", false
}
return v1, true
}
// DecodePausesByDroppedIDValue reads one value of the state pauses under the form "dropped.<id>", refusing a field PausesByDroppedIDValue does not know and any text after the value.
func DecodePausesByDroppedIDValue(raw []byte) (PausesByDroppedIDValue, error) {
var v PausesByDroppedIDValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
}
// PausesByCapacityNodeKey is the key of one value of the state pauses under the form "capacity.<node>".
func PausesByCapacityNodeKey(node string) string { return "capacity." + node }
@@ -245,6 +281,16 @@ type ComposeAnswer struct {
Verdict any `json:"verdict,omitempty"`
}
// Drop is an ask a caller no longer waits for.
type Drop struct {
// when (RFC 3339 time)
At *time.Time `json:"at,omitempty"`
By string `json:"by,omitempty"`
// the layout version
V int64 `json:"v,omitempty"`
Why string `json:"why"`
}
// FetchBesideItem is a type of the contract.
type FetchBesideItem struct {
Commit string `json:"commit"`
@@ -433,19 +479,25 @@ type RunProgram struct {
// Step is one step a build module runs on a node.
type Step struct {
// when the bus gives the ask again, for the state again (RFC 3339 time)
AgainAt *time.Time `json:"again-at,omitempty"`
// when (RFC 3339 time)
Ended *time.Time `json:"ended,omitempty"`
ID string `json:"id"`
Node string `json:"node"`
Owner string `json:"owner,omitempty"`
Phase string `json:"phase,omitempty"`
// true when the step ended on a fault that passes (a transport fault), so a failed end after the last run says so
Passing bool `json:"passing,omitempty"`
Phase string `json:"phase,omitempty"`
// when (RFC 3339 time)
PhaseAt *time.Time `json:"phase-at,omitempty"`
Reason string `json:"reason,omitempty"`
Result *StepResult `json:"result,omitempty"`
// which run of the ask this is, counted by the bus's delivery count (1 for the first)
Run int64 `json:"run,omitempty"`
// when (RFC 3339 time)
Started time.Time `json:"started"`
// running, passed, failed or refused
// running, again (ended on a transport fault, to be given again by the bus after again-at), passed, failed, refused or dropped (ended by the verb drop, its cause the reason)
State string `json:"state"`
Tool string `json:"tool"`
// the layout version
@@ -485,7 +537,7 @@ type StepAskCompose struct {
Fetch Fetch `json:"fetch"`
Package string `json:"package"`
Reader string `json:"reader,omitempty"`
// the compose-candidate request
// the compose-candidate request, in one of two forms: the request as a JSON object, or, for one near the bus's message limit, a JSON string "gzip+base64:" followed by the base64 of the request object gzip-compressed; a holder that does not know the packed form refuses it, naming that it holds no request object
Request any `json:"request"`
}
@@ -588,6 +640,19 @@ type ResumeInput struct {
// ResumeAnswer is what resume answers.
type ResumeAnswer = map[string]any
// DropInput is what drop takes.
type DropInput struct {
// who drops it
By string `json:"by,omitempty"`
// the ask's id
ID string `json:"id"`
// why the caller no longer waits
Why string `json:"why"`
}
// DropAnswer is what drop answers.
type DropAnswer = map[string]any
// DeliveryAccept is the body of delivery.
type DeliveryAccept = StepAsk
@@ -603,6 +668,9 @@ type StepsByNodeIDValue = Step
// PausesByPausedNodeValue is one value of the state pauses under the key paused.<node>.
type PausesByPausedNodeValue = Pause
// PausesByDroppedIDValue is one value of the state pauses under the key dropped.<id>.
type PausesByDroppedIDValue = Drop
// PausesByCapacityNodeValue is one value of the state pauses under the key capacity.<node>.
type PausesByCapacityNodeValue = Capacity
@@ -53,6 +53,12 @@ func TestFixtures(t *testing.T) {
decode: func(b []byte) (any, error) { var v CheckAccept; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-build-go\\.accept\\.check$")},
{name: "a finished run step whose program exited non-zero", subject: "", given: "{\"ended\":\"2026-11-05T10:01:00Z\",\"id\":\"r5e6\",\"node\":\"ace\",\"result\":{\"built\":true,\"exit\":2,\"key\":\"program-0123456789abcdef\",\"said\":\"the facts name no head\"},\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"failed\",\"tool\":\"check\",\"v\":1}", wire: "{\"ended\":\"2026-11-05T10:01:00Z\",\"id\":\"r5e6\",\"node\":\"ace\",\"result\":{\"built\":true,\"exit\":2,\"key\":\"program-0123456789abcdef\",\"said\":\"the facts name no head\"},\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"failed\",\"tool\":\"check\",\"v\":1}",
decode: func(b []byte) (any, error) { var v StepsByNodeIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "a step ended on a transport fault, given again by the bus", subject: "", given: "{\"again-at\":\"2026-11-05T10:01:30Z\",\"ended\":\"2026-11-05T10:00:30Z\",\"id\":\"a1b2\",\"node\":\"ace\",\"passing\":true,\"reason\":\"fetching the commit: kex_exchange_identification: read: Connection reset by peer\",\"run\":1,\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"again\",\"tool\":\"build\",\"v\":1}", wire: "{\"again-at\":\"2026-11-05T10:01:30Z\",\"ended\":\"2026-11-05T10:00:30Z\",\"id\":\"a1b2\",\"node\":\"ace\",\"passing\":true,\"reason\":\"fetching the commit: kex_exchange_identification: read: Connection reset by peer\",\"run\":1,\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"again\",\"tool\":\"build\",\"v\":1}",
decode: func(b []byte) (any, error) { var v StepsByNodeIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "an ask dropped by the caller that no longer waits", subject: "", given: "{\"at\":\"2026-11-05T10:00:00Z\",\"by\":\"mesh-delivery-builder\",\"v\":1,\"why\":\"a newer fingerprint supersedes it\"}", wire: "{\"at\":\"2026-11-05T10:00:00Z\",\"by\":\"mesh-delivery-builder\",\"v\":1,\"why\":\"a newer fingerprint supersedes it\"}",
decode: func(b []byte) (any, error) { var v PausesByDroppedIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "drop names the ask and why", subject: "", given: "{\"by\":\"mesh-delivery-builder\",\"id\":\"a1b2\",\"why\":\"a newer fingerprint supersedes it\"}", wire: "{\"by\":\"mesh-delivery-builder\",\"id\":\"a1b2\",\"why\":\"a newer fingerprint supersedes it\"}",
decode: func(b []byte) (any, error) { var v DropInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
}
for _, c := range cases {
v, err := c.decode([]byte(c.given))
+72 -4
View File
@@ -18,6 +18,7 @@ const (
VerbCurrent = "current"
VerbPause = "pause"
VerbResume = "resume"
VerbDrop = "drop"
)
const (
@@ -28,7 +29,7 @@ const (
// Verbs is every verb the seat serves, in its definition's order: a new copy each call.
func Verbs() []string {
return []string{VerbCurrent, VerbPause, VerbResume}
return []string{VerbCurrent, VerbPause, VerbResume, VerbDrop}
}
// AcceptSubjectDelivery is where delivery is sent.
@@ -117,6 +118,41 @@ func DecodePausesByPausedNodeValue(raw []byte) (PausesByPausedNodeValue, error)
return v, nil
}
// PausesByDroppedIDKey is the key of one value of the state pauses under the form "dropped.<id>".
func PausesByDroppedIDKey(id string) string { return "dropped." + id }
// ParsePausesByDroppedIDKey reads the parts of a key of the form "dropped.<id>", in the order of the form; the last result is false for a key of another form.
func ParsePausesByDroppedIDKey(key string) (string, bool) {
rest := key
if !strings.HasPrefix(rest, "dropped.") {
return "", false
}
rest = rest[8:]
if rest == "" {
return "", false
}
v1 := rest
rest = ""
if rest != "" {
return "", false
}
return v1, true
}
// DecodePausesByDroppedIDValue reads one value of the state pauses under the form "dropped.<id>", refusing a field PausesByDroppedIDValue does not know and any text after the value.
func DecodePausesByDroppedIDValue(raw []byte) (PausesByDroppedIDValue, error) {
var v PausesByDroppedIDValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
}
// PausesByCapacityNodeKey is the key of one value of the state pauses under the form "capacity.<node>".
func PausesByCapacityNodeKey(node string) string { return "capacity." + node }
@@ -245,6 +281,16 @@ type ComposeAnswer struct {
Verdict any `json:"verdict,omitempty"`
}
// Drop is an ask a caller no longer waits for.
type Drop struct {
// when (RFC 3339 time)
At *time.Time `json:"at,omitempty"`
By string `json:"by,omitempty"`
// the layout version
V int64 `json:"v,omitempty"`
Why string `json:"why"`
}
// FetchBesideItem is a type of the contract.
type FetchBesideItem struct {
Commit string `json:"commit"`
@@ -433,19 +479,25 @@ type RunProgram struct {
// Step is one step a build module runs on a node.
type Step struct {
// when the bus gives the ask again, for the state again (RFC 3339 time)
AgainAt *time.Time `json:"again-at,omitempty"`
// when (RFC 3339 time)
Ended *time.Time `json:"ended,omitempty"`
ID string `json:"id"`
Node string `json:"node"`
Owner string `json:"owner,omitempty"`
Phase string `json:"phase,omitempty"`
// true when the step ended on a fault that passes (a transport fault), so a failed end after the last run says so
Passing bool `json:"passing,omitempty"`
Phase string `json:"phase,omitempty"`
// when (RFC 3339 time)
PhaseAt *time.Time `json:"phase-at,omitempty"`
Reason string `json:"reason,omitempty"`
Result *StepResult `json:"result,omitempty"`
// which run of the ask this is, counted by the bus's delivery count (1 for the first)
Run int64 `json:"run,omitempty"`
// when (RFC 3339 time)
Started time.Time `json:"started"`
// running, passed, failed or refused
// running, again (ended on a transport fault, to be given again by the bus after again-at), passed, failed, refused or dropped (ended by the verb drop, its cause the reason)
State string `json:"state"`
Tool string `json:"tool"`
// the layout version
@@ -485,7 +537,7 @@ type StepAskCompose struct {
Fetch Fetch `json:"fetch"`
Package string `json:"package"`
Reader string `json:"reader,omitempty"`
// the compose-candidate request
// the compose-candidate request, in one of two forms: the request as a JSON object, or, for one near the bus's message limit, a JSON string "gzip+base64:" followed by the base64 of the request object gzip-compressed; a holder that does not know the packed form refuses it, naming that it holds no request object
Request any `json:"request"`
}
@@ -588,6 +640,19 @@ type ResumeInput struct {
// ResumeAnswer is what resume answers.
type ResumeAnswer = map[string]any
// DropInput is what drop takes.
type DropInput struct {
// who drops it
By string `json:"by,omitempty"`
// the ask's id
ID string `json:"id"`
// why the caller no longer waits
Why string `json:"why"`
}
// DropAnswer is what drop answers.
type DropAnswer = map[string]any
// DeliveryAccept is the body of delivery.
type DeliveryAccept = StepAsk
@@ -603,6 +668,9 @@ type StepsByNodeIDValue = Step
// PausesByPausedNodeValue is one value of the state pauses under the key paused.<node>.
type PausesByPausedNodeValue = Pause
// PausesByDroppedIDValue is one value of the state pauses under the key dropped.<id>.
type PausesByDroppedIDValue = Drop
// PausesByCapacityNodeValue is one value of the state pauses under the key capacity.<node>.
type PausesByCapacityNodeValue = Capacity
@@ -39,6 +39,12 @@ func TestFixtures(t *testing.T) {
}, subjectIs: nil},
{name: "a build ask", subject: "mesh.seat.node-build-image.accept.delivery", given: "{\"asker\":\"mesh-delivery-builder\",\"build\":{\"artifacts\":[{\"artifact\":\"go\"}],\"module\":\"nats\"},\"id\":\"a1b2\",\"kind\":\"build\",\"language\":\"go\"}", wire: "{\"asker\":\"mesh-delivery-builder\",\"build\":{\"artifacts\":[{\"artifact\":\"go\"}],\"module\":\"nats\"},\"id\":\"a1b2\",\"kind\":\"build\",\"language\":\"go\"}",
decode: func(b []byte) (any, error) { var v DeliveryAccept; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-build-image\\.accept\\.delivery$")},
{name: "a step ended on a transport fault, given again by the bus", subject: "", given: "{\"again-at\":\"2026-11-05T10:01:30Z\",\"ended\":\"2026-11-05T10:00:30Z\",\"id\":\"a1b2\",\"node\":\"ace\",\"passing\":true,\"reason\":\"fetching the commit: kex_exchange_identification: read: Connection reset by peer\",\"run\":1,\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"again\",\"tool\":\"build\",\"v\":1}", wire: "{\"again-at\":\"2026-11-05T10:01:30Z\",\"ended\":\"2026-11-05T10:00:30Z\",\"id\":\"a1b2\",\"node\":\"ace\",\"passing\":true,\"reason\":\"fetching the commit: kex_exchange_identification: read: Connection reset by peer\",\"run\":1,\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"again\",\"tool\":\"build\",\"v\":1}",
decode: func(b []byte) (any, error) { var v StepsByNodeIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "an ask dropped by the caller that no longer waits", subject: "", given: "{\"at\":\"2026-11-05T10:00:00Z\",\"by\":\"mesh-delivery-builder\",\"v\":1,\"why\":\"a newer fingerprint supersedes it\"}", wire: "{\"at\":\"2026-11-05T10:00:00Z\",\"by\":\"mesh-delivery-builder\",\"v\":1,\"why\":\"a newer fingerprint supersedes it\"}",
decode: func(b []byte) (any, error) { var v PausesByDroppedIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "drop names the ask and why", subject: "", given: "{\"by\":\"mesh-delivery-builder\",\"id\":\"a1b2\",\"why\":\"a newer fingerprint supersedes it\"}", wire: "{\"by\":\"mesh-delivery-builder\",\"id\":\"a1b2\",\"why\":\"a newer fingerprint supersedes it\"}",
decode: func(b []byte) (any, error) { var v DropInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
}
for _, c := range cases {
v, err := c.decode([]byte(c.given))
+72 -4
View File
@@ -18,6 +18,7 @@ const (
VerbCurrent = "current"
VerbPause = "pause"
VerbResume = "resume"
VerbDrop = "drop"
)
const (
@@ -28,7 +29,7 @@ const (
// Verbs is every verb the seat serves, in its definition's order: a new copy each call.
func Verbs() []string {
return []string{VerbCurrent, VerbPause, VerbResume}
return []string{VerbCurrent, VerbPause, VerbResume, VerbDrop}
}
// AcceptSubjectDelivery is where delivery is sent.
@@ -117,6 +118,41 @@ func DecodePausesByPausedNodeValue(raw []byte) (PausesByPausedNodeValue, error)
return v, nil
}
// PausesByDroppedIDKey is the key of one value of the state pauses under the form "dropped.<id>".
func PausesByDroppedIDKey(id string) string { return "dropped." + id }
// ParsePausesByDroppedIDKey reads the parts of a key of the form "dropped.<id>", in the order of the form; the last result is false for a key of another form.
func ParsePausesByDroppedIDKey(key string) (string, bool) {
rest := key
if !strings.HasPrefix(rest, "dropped.") {
return "", false
}
rest = rest[8:]
if rest == "" {
return "", false
}
v1 := rest
rest = ""
if rest != "" {
return "", false
}
return v1, true
}
// DecodePausesByDroppedIDValue reads one value of the state pauses under the form "dropped.<id>", refusing a field PausesByDroppedIDValue does not know and any text after the value.
func DecodePausesByDroppedIDValue(raw []byte) (PausesByDroppedIDValue, error) {
var v PausesByDroppedIDValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
}
// PausesByCapacityNodeKey is the key of one value of the state pauses under the form "capacity.<node>".
func PausesByCapacityNodeKey(node string) string { return "capacity." + node }
@@ -245,6 +281,16 @@ type ComposeAnswer struct {
Verdict any `json:"verdict,omitempty"`
}
// Drop is an ask a caller no longer waits for.
type Drop struct {
// when (RFC 3339 time)
At *time.Time `json:"at,omitempty"`
By string `json:"by,omitempty"`
// the layout version
V int64 `json:"v,omitempty"`
Why string `json:"why"`
}
// FetchBesideItem is a type of the contract.
type FetchBesideItem struct {
Commit string `json:"commit"`
@@ -433,19 +479,25 @@ type RunProgram struct {
// Step is one step a build module runs on a node.
type Step struct {
// when the bus gives the ask again, for the state again (RFC 3339 time)
AgainAt *time.Time `json:"again-at,omitempty"`
// when (RFC 3339 time)
Ended *time.Time `json:"ended,omitempty"`
ID string `json:"id"`
Node string `json:"node"`
Owner string `json:"owner,omitempty"`
Phase string `json:"phase,omitempty"`
// true when the step ended on a fault that passes (a transport fault), so a failed end after the last run says so
Passing bool `json:"passing,omitempty"`
Phase string `json:"phase,omitempty"`
// when (RFC 3339 time)
PhaseAt *time.Time `json:"phase-at,omitempty"`
Reason string `json:"reason,omitempty"`
Result *StepResult `json:"result,omitempty"`
// which run of the ask this is, counted by the bus's delivery count (1 for the first)
Run int64 `json:"run,omitempty"`
// when (RFC 3339 time)
Started time.Time `json:"started"`
// running, passed, failed or refused
// running, again (ended on a transport fault, to be given again by the bus after again-at), passed, failed, refused or dropped (ended by the verb drop, its cause the reason)
State string `json:"state"`
Tool string `json:"tool"`
// the layout version
@@ -485,7 +537,7 @@ type StepAskCompose struct {
Fetch Fetch `json:"fetch"`
Package string `json:"package"`
Reader string `json:"reader,omitempty"`
// the compose-candidate request
// the compose-candidate request, in one of two forms: the request as a JSON object, or, for one near the bus's message limit, a JSON string "gzip+base64:" followed by the base64 of the request object gzip-compressed; a holder that does not know the packed form refuses it, naming that it holds no request object
Request any `json:"request"`
}
@@ -588,6 +640,19 @@ type ResumeInput struct {
// ResumeAnswer is what resume answers.
type ResumeAnswer = map[string]any
// DropInput is what drop takes.
type DropInput struct {
// who drops it
By string `json:"by,omitempty"`
// the ask's id
ID string `json:"id"`
// why the caller no longer waits
Why string `json:"why"`
}
// DropAnswer is what drop answers.
type DropAnswer = map[string]any
// DeliveryAccept is the body of delivery.
type DeliveryAccept = StepAsk
@@ -603,6 +668,9 @@ type StepsByNodeIDValue = Step
// PausesByPausedNodeValue is one value of the state pauses under the key paused.<node>.
type PausesByPausedNodeValue = Pause
// PausesByDroppedIDValue is one value of the state pauses under the key dropped.<id>.
type PausesByDroppedIDValue = Drop
// PausesByCapacityNodeValue is one value of the state pauses under the key capacity.<node>.
type PausesByCapacityNodeValue = Capacity
@@ -43,6 +43,12 @@ func TestFixtures(t *testing.T) {
decode: func(b []byte) (any, error) { var v CheckAccept; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-build-node\\.accept\\.check$")},
{name: "a finished check step of a TypeScript merge preview", subject: "", given: "{\"ended\":\"2026-11-05T10:01:00Z\",\"id\":\"c3d6\",\"node\":\"ace\",\"result\":{\"fetch\":{\"base\":\"abcdef0123456789abcdef0123456789abcdef01\",\"changed\":[\"modules/m/package.json\"],\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"merge\":\"0123456789abcdef0123456789abcdef01234567\",\"modules\":[\"modules/m\"],\"trees\":{\"modules/m\":{\"manifest\":\"0581b699d9d05517e69b21f5cedbeb2eee8aba2b205280b561be731594d7feef\",\"tree\":\"0123456789abcdef0123456789abcdef01234567\"}},\"workspace\":\"mvii1sxt979f67\"}},\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"passed\",\"tool\":\"check\",\"v\":1}", wire: "{\"ended\":\"2026-11-05T10:01:00Z\",\"id\":\"c3d6\",\"node\":\"ace\",\"result\":{\"fetch\":{\"base\":\"abcdef0123456789abcdef0123456789abcdef01\",\"changed\":[\"modules/m/package.json\"],\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"merge\":\"0123456789abcdef0123456789abcdef01234567\",\"modules\":[\"modules/m\"],\"trees\":{\"modules/m\":{\"manifest\":\"0581b699d9d05517e69b21f5cedbeb2eee8aba2b205280b561be731594d7feef\",\"tree\":\"0123456789abcdef0123456789abcdef01234567\"}},\"workspace\":\"mvii1sxt979f67\"}},\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"passed\",\"tool\":\"check\",\"v\":1}",
decode: func(b []byte) (any, error) { var v StepsByNodeIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "a step ended on a transport fault, given again by the bus", subject: "", given: "{\"again-at\":\"2026-11-05T10:01:30Z\",\"ended\":\"2026-11-05T10:00:30Z\",\"id\":\"a1b2\",\"node\":\"ace\",\"passing\":true,\"reason\":\"fetching the commit: kex_exchange_identification: read: Connection reset by peer\",\"run\":1,\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"again\",\"tool\":\"build\",\"v\":1}", wire: "{\"again-at\":\"2026-11-05T10:01:30Z\",\"ended\":\"2026-11-05T10:00:30Z\",\"id\":\"a1b2\",\"node\":\"ace\",\"passing\":true,\"reason\":\"fetching the commit: kex_exchange_identification: read: Connection reset by peer\",\"run\":1,\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"again\",\"tool\":\"build\",\"v\":1}",
decode: func(b []byte) (any, error) { var v StepsByNodeIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "an ask dropped by the caller that no longer waits", subject: "", given: "{\"at\":\"2026-11-05T10:00:00Z\",\"by\":\"mesh-delivery-builder\",\"v\":1,\"why\":\"a newer fingerprint supersedes it\"}", wire: "{\"at\":\"2026-11-05T10:00:00Z\",\"by\":\"mesh-delivery-builder\",\"v\":1,\"why\":\"a newer fingerprint supersedes it\"}",
decode: func(b []byte) (any, error) { var v PausesByDroppedIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "drop names the ask and why", subject: "", given: "{\"by\":\"mesh-delivery-builder\",\"id\":\"a1b2\",\"why\":\"a newer fingerprint supersedes it\"}", wire: "{\"by\":\"mesh-delivery-builder\",\"id\":\"a1b2\",\"why\":\"a newer fingerprint supersedes it\"}",
decode: func(b []byte) (any, error) { var v DropInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
}
for _, c := range cases {
v, err := c.decode([]byte(c.given))
File diff suppressed because it is too large Load Diff
-9
View File
@@ -1,9 +0,0 @@
{
"format": 1,
"seat": "git",
"scope": "mesh",
"grain": "seat-list",
"domain": "Delivery",
"decision": "novox/hq ADR 0111",
"delivers": "git"
}
@@ -1,223 +0,0 @@
[
{
"name": "a manifest (xclip, read through mesh-catalog.module)",
"of": "state:manifests/<digest>",
"given": {
"v": 1,
"module": "xclip",
"manifest": "{\"build\":{\"artifacts\":[{\"binary\":\"xclip-tools\",\"from\":\"cmd/xclip-tools\",\"kind\":\"bundle\",\"language\":\"go\",\"loads\":[\"xclip-tools\"],\"name\":\"tools\",\"system\":\"arch\"}]},\"capabilities\":[\"package-manager\"],\"module\":\"xclip\",\"resources\":[{\"id\":\"package\",\"package\":\"xclip\",\"type\":\"package\"}],\"tools\":[\"xclip_copy\",\"xclip_paste\",\"xclip_targets\",\"xclip_session\"],\"version\":\"1\"}"
}
},
{
"name": "a module (xclip, read through mesh-catalog.modules; the inputs and toolchains no tool reads are not here)",
"of": "state:modules/<module>",
"given": {
"v": 1,
"repository": "novox/mesh-catalog",
"commit": "f469eb387a3015569d9b16c66ed418e9dd098f64",
"path": "modules/xclip",
"fp2": "src2:b427bdde1f100e2f52490cfa9df0c5112dd3700226b4892349f0c14a15a4af56"
}
},
{
"name": "a candidate",
"of": "state:candidates/<group>",
"given": {
"v": 1,
"group": "feat/registry",
"base": 3,
"heads": "0123456789ab",
"pulls": [
{
"repository": "novox/mesh-sdk",
"number": 1,
"head": "cccccccccccccccccccccccccccccccccccccccc",
"modules": [
"nats"
]
}
]
}
},
{
"name": "a refused verdict (nats, read through the indexer's verdicts tool)",
"of": "state:verdicts/<digest>",
"given": {
"module": "nats",
"state": "refused",
"problems": [
"this is not a module manifest: a state is either a name or {name, history, ttl-seconds, per-machine, key-ttl}: json: unknown field \"read-only\" (read without state[2].read-only)"
],
"judge": "exe:661e6fb424d7ffea",
"at": "2026-11-04T18:51:12.614583047+01:00"
}
},
{
"name": "the predefined list",
"of": "state:predefined/list",
"given": {
"v": 1,
"commit": "cccccccccccccccccccccccccccccccccccccccc",
"list": {
"streams": []
}
}
},
{
"name": "a pull request's configuration",
"of": "state:config-candidates/<pull>",
"given": {
"v": 1,
"pull": "novox/mesh-catalog#1",
"head": "cccccccccccccccccccccccccccccccccccccccc",
"declares": {
"nats": {
"limit": {
"kind": "setting",
"default": 1,
"why": "a bound"
}
}
}
}
},
{
"name": "a pull request's configuration state whose bounds are declared 0 (a zero is a bound, not none)",
"of": "state:config-candidates/<pull>",
"given": {
"v": 1,
"pull": "novox/mesh-catalog#1",
"head": "cccccccccccccccccccccccccccccccccccccccc",
"declares": {
"nats": {
"limit": {
"kind": "setting",
"default": 0,
"why": "a bound",
"minimum": 0,
"maximum": 0
}
}
}
}
},
{
"name": "a published Go module",
"of": "state:packages/<module>",
"given": {
"v": 1,
"module": "git.novox.be/novox/mesh-sdk/go",
"repository": "novox/mesh-sdk",
"commit": "cccccccccccccccccccccccccccccccccccccccc",
"packages": [
{
"package": "git.novox.be/novox/mesh-sdk/go/keys",
"digest": "ab"
}
]
}
},
{
"name": "a package series",
"of": "state:packages/<package>.<series>",
"given": {
"v": 1,
"name": "go-keys",
"series": "0.1"
}
},
{
"name": "a module with its toolchain",
"of": "state:modules/<module>",
"given": {
"v": 1,
"repository": "novox/mesh-catalog",
"commit": "f469eb387a3015569d9b16c66ed418e9dd098f64",
"fp2": "src2:b427bdde1f100e2f52490cfa9df0c5112dd3700226b4892349f0c14a15a4af56",
"toolchains": {
"go": {
"language": "go",
"version": "1.26.0",
"recipe": "1"
}
}
}
},
{
"name": "the modules verb (captured: the first three modules)",
"of": "verb:modules.answer",
"given": {
"modules": [
{
"commit": "f469eb387a3015569d9b16c66ed418e9dd098f64",
"fp": "src2:5e4a1b4ad4ea6175c05e4655ce58aeb957547149d4c9805eb27636efd50c1c87",
"module": "adwaita",
"path": "modules/adwaita",
"repository": "novox/mesh-catalog"
},
{
"commit": "b112adcecc41d18f54190cbd2fc864199b70c518",
"fp": "src2:7dd0db8e98224f46121a5ae05c0b9c5a430eff531a5120aa40b1a59237853a3f",
"module": "amqp-email-forwarder",
"path": ".",
"repository": "jschoubben/amqp-email-forwarder"
},
{
"commit": "dd458cb155f5f5fa3ed824a23728e444be5b156a",
"fp": "src2:a98f8152f0a837dd5ba883a15efaf110ba88100193157e4bdb1a93ba55209371",
"module": "artifact-store-tools",
"path": "modules/artifact-store-tools",
"repository": "novox/mesh-catalog"
}
]
}
},
{
"name": "the module verb (captured: xclip)",
"of": "verb:module.answer",
"given": {
"module": {
"commit": "f469eb387a3015569d9b16c66ed418e9dd098f64",
"fp": "src2:b427bdde1f100e2f52490cfa9df0c5112dd3700226b4892349f0c14a15a4af56",
"manifest": {
"build": {
"artifacts": [
{
"binary": "xclip-tools",
"from": "cmd/xclip-tools",
"kind": "bundle",
"language": "go",
"loads": [
"xclip-tools"
],
"name": "tools",
"system": "arch"
}
]
},
"capabilities": [
"package-manager"
],
"module": "xclip",
"resources": [
{
"id": "package",
"package": "xclip",
"type": "package"
}
],
"tools": [
"xclip_copy",
"xclip_paste",
"xclip_targets",
"xclip_session"
],
"version": "1"
},
"module": "xclip",
"path": "modules/xclip",
"repository": "novox/mesh-catalog"
}
}
}
]
File diff suppressed because it is too large Load Diff
@@ -1,44 +0,0 @@
[
{
"name": "verdict on the checker's own family",
"of": "holder-event:verdict",
"subject": "mesh.stream.mesh-delivery-checker.event.verdict",
"given": {
"repository": "novox/mesh-contracts",
"pull": 3,
"head": "cccccccccccccccccccccccccccccccccccccccc",
"verdict": "fail",
"out-of-step": [
"go/seats/meshbroker/contract.go"
],
"series": [
{
"module": "mesh-contracts",
"artifact": "go",
"from": "0.1",
"to": "0.2"
}
]
}
},
{
"name": "tag-wanted on the checker's own family",
"of": "holder-event:tag-wanted",
"subject": "mesh.stream.mesh-delivery-checker.event.tag-wanted",
"given": {
"repository": "novox/mesh-sdk",
"pull": 170,
"head": "cccccccccccccccccccccccccccccccccccccccc",
"branch": "feat/registry",
"module": "mesh-sdk",
"package": "go",
"tag": "registry-1966"
}
},
{
"name": "preview.written on the checker's stream",
"of": "holder-event:preview.written",
"subject": "mesh.stream.mesh-delivery-checker.event.preview.written",
"given": {}
}
]
-574
View File
@@ -1,574 +0,0 @@
{
"format": 1,
"seat": "mesh-delivery",
"scope": "mesh",
"grain": "whole",
"domain": "Delivery",
"decision": "novox/hq ADR 0239",
"verbs": [
{
"name": "deliveries",
"description": "Every delivery not final, and those that ended in the last day, one line each: its id (owner/repository@commit), its state, its group, what it waits for and since when. Narrowed by state, repository or group.",
"input": {
"properties": {
"all": {
"description": "\"true\": the final ones of the last thirty days too",
"enum": [
"true",
"false"
],
"type": "string"
},
"group": {
"description": "a group's id (its branch name)",
"type": "string"
},
"repository": {
"description": "owner/repository",
"type": "string"
},
"state": {
"description": "one state, e.g. delivering or held",
"type": "string"
}
},
"type": "object"
},
"answer": {
"type": "object",
"description": "what deliveries answers, as its description says"
}
},
{
"name": "times",
"description": "Removed in R6 (ADR 0539): refused by name, naming its replacement: the delivery view (nox-delivery): each machine's want and have, and since when",
"optional": true,
"input": {
"properties": {},
"type": "object"
},
"answer": {
"type": "object",
"description": "what times answers, as its description says"
}
},
{
"name": "show",
"description": "One delivery or group whole: its delivery plan (what it builds, what each machine receives, what is not an ordinary send), every transition with when and why, the machine steps of its walk, its group and its order.",
"input": {
"properties": {
"id": {
"description": "a delivery's id, or a group's",
"type": "string"
}
},
"required": [
"id"
],
"type": "object"
},
"answer": {
"type": "object",
"description": "what show answers, as its description says"
}
},
{
"name": "groups",
"description": "Every delivery group: its members in order, why each pair is ordered (declared, built by, version skew, engine before controller, by name), its composed check and its state, derived from its members.",
"input": {
"properties": {
"all": {
"description": "\"true\": the groups that ended too",
"enum": [
"true",
"false"
],
"type": "string"
}
},
"type": "object"
},
"answer": {
"type": "object",
"description": "what groups answers, as its description says"
}
},
{
"name": "what-if",
"description": "Removed in R6 (ADR 0539): refused by name, naming its replacement: the merge check's composition, which composes every machine a change touches",
"optional": true,
"input": {
"properties": {},
"type": "object"
},
"answer": {
"type": "object",
"description": "what what-if answers, as its description says"
}
},
{
"name": "checks",
"description": "What the mesh's checks said of a pull request's head or of one commit: each of the commit's mesh statuses (mesh/check, the one a main requires from R4e, hq's mesh/repo-check, mesh/delivery, …) with its state, description and when it was set; the merge check's full verdict as the controller said it — each layer's summary, the machine that ran it, when, its build id and its report; and whether the branch's protection would let it merge, every required status being success.",
"optional": true,
"input": {
"properties": {
"commit": {
"description": "a commit's sha, or the start of one, instead of a pull request",
"type": "string"
},
"number": {
"description": "a pull request's number: its head is read",
"type": "string"
},
"repository": {
"description": "owner/repository",
"type": "string"
}
},
"required": [
"repository"
],
"type": "object"
},
"answer": {
"type": "object",
"description": "what checks answers, as its description says"
}
},
{
"name": "table",
"description": "The state table every delivery runs by: each transition with its guard, each state's bound and what healer H2 may do once it has passed; and the machine steps' table.",
"input": {
"properties": {},
"type": "object"
},
"answer": {
"type": "object",
"description": "what table answers, as its description says"
}
},
{
"name": "stalled",
"description": "Every delivery held past its state's bound, with the transition the table lets healer H2 take for it, or none.",
"input": {
"properties": {},
"type": "object"
},
"answer": {
"type": "object",
"description": "what stalled answers, as its description says"
}
},
{
"name": "recheck",
"description": "Check a rejected or ready delivery again: it goes back to proposed and the controller is asked for its check. With why.",
"input": {
"properties": {
"id": {
"description": "the delivery's id",
"type": "string"
},
"why": {
"description": "why, kept with the transition",
"type": "string"
}
},
"required": [
"id",
"why"
],
"type": "object"
},
"answer": {
"type": "object",
"description": "what recheck answers, as its description says"
}
},
{
"name": "release",
"description": "Removed in R6 (ADR 0539): refused by name, naming its replacement: the assigner's asks (hold, restore, backup, record), answered on the phone or in the delivery view",
"optional": true,
"input": {
"properties": {},
"type": "object"
},
"answer": {
"type": "object",
"description": "what release answers, as its description says"
}
},
{
"name": "stop",
"description": "Removed in R6 (ADR 0539): refused by name, naming its replacement: a bad fingerprint is held and its canary set back by the assigner (ADR 0429 §6, ADR 0539 clause 18)",
"optional": true,
"input": {
"properties": {},
"type": "object"
},
"answer": {
"type": "object",
"description": "what stop answers, as its description says"
}
},
{
"name": "close",
"description": "Healer H2's verb: take the one transition the table names for a delivery held past its bound. Refused for any other.",
"input": {
"properties": {
"id": {
"description": "the delivery's id",
"type": "string"
},
"why": {
"description": "the condition it answers",
"type": "string"
}
},
"required": [
"id",
"why"
],
"type": "object"
},
"answer": {
"type": "object",
"description": "what close answers, as its description says"
}
},
{
"name": "retire-history",
"description": "Removed in R6 (ADR 0539): refused by name, naming its replacement: nothing to retire: the gate keeps no delivery after its merge",
"optional": true,
"input": {
"properties": {},
"type": "object"
},
"answer": {
"type": "object",
"description": "what retire-history answers, as its description says"
}
},
{
"name": "settle",
"description": "Ask the operator to settle deliveries held because their merge reached the trunk without a passing check: one ask on the operator's channel for all of them, as an Approve is asked. The verb moves nothing; on the operator's answer each goes to merged, and whether it is on the machines is derived as for any merge (novox/hq ADR 0556). Refused for a delivery not held, or held for another reason, naming why.",
"optional": true,
"input": {
"additionalProperties": false,
"properties": {
"ids": {
"description": "the held deliveries' ids (owner/repository@commit)",
"items": {
"type": "string"
},
"minItems": 1,
"type": "array"
},
"why": {
"description": "why they may be settled, shown to the operator",
"type": "string"
}
},
"required": [
"ids",
"why"
],
"type": "object"
},
"answer": {
"type": "object",
"description": "what settle answers, as its description says"
}
}
],
"description": "The delivery gate: reads and steers deliveries, merges and the checks that decide them; the merge is made on the operator's Approve once both checks passed.",
"states": [
{
"name": "source",
"template": "state",
"key-forms": [
{
"key": "main",
"value": {
"type": "object",
"properties": {
"v": {
"type": "integer",
"description": "the layout version"
},
"group": {
"type": "string",
"description": "the group that moved it"
},
"heads": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "repository to the merged head, a full commit"
}
},
"required": [
"group",
"heads"
],
"description": "every repository's merged head; its revision is the mesh's source revision"
},
"description": "the one key, written by the holder alone by compare-and-set"
}
],
"description": "the mesh's source revision",
"history": 64
},
{
"name": "merges",
"template": "state",
"key-forms": [
{
"key": "<group>",
"value": {
"type": "object",
"properties": {
"v": {
"type": "integer",
"description": "the layout version"
},
"group": {
"type": "string"
},
"ask": {
"type": "string",
"description": "the ask key"
},
"approved": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "<repository>@<number> to the approved head"
},
"pulls": {
"type": "array",
"items": {
"type": "object",
"properties": {
"repository": {
"type": "string"
},
"number": {
"type": "integer"
},
"head": {
"type": "string"
},
"state": {
"type": "string",
"description": "merging, merged or refused"
},
"commit": {
"type": "string"
},
"words": {
"type": "string"
}
},
"required": [
"repository",
"number",
"head",
"state"
]
}
}
},
"required": [
"group",
"ask",
"pulls"
],
"description": "one group's merge and how far each pull request is"
},
"description": "a group's merge"
}
],
"description": "the merges",
"history": 10
},
{
"name": "asks",
"template": "state",
"key-forms": [
{
"key": "merge.<group>.<heads>",
"value": {
"type": "object",
"properties": {
"v": {
"type": "integer",
"description": "the layout version"
},
"group": {
"type": "string"
},
"heads": {
"type": "array",
"items": {
"type": "object",
"properties": {
"repository": {
"type": "string",
"description": "<owner>/<name>"
},
"number": {
"type": "integer"
},
"head": {
"type": "string",
"description": "the full commit"
}
},
"required": [
"repository",
"number",
"head"
]
}
},
"ask": {
"description": "the operator-channel ask as raised"
},
"asking": {
"type": "integer",
"description": "the number of times it was asked"
}
},
"required": [
"group",
"heads",
"ask"
]
},
"description": "the ask of the operator for one group at one set of heads"
}
],
"description": "the asks of the operator for a merge",
"history": 5
},
{
"name": "owed",
"template": "state",
"key-forms": [
{
"key": "<repository>.<number>.<head>.<act>",
"value": {
"type": "object",
"properties": {
"v": {
"type": "integer",
"description": "the layout version"
},
"act": {
"type": "string",
"description": "status=<context>, view, note or comment.<seq>"
},
"context": {
"type": "string"
},
"target": {
"type": "string"
},
"state": {
"type": "string"
},
"text": {
"type": "string"
},
"ref": {
"type": "string"
}
},
"required": [
"act"
],
"description": "one act owed to the forge, written by its owner and done by the forge bridge"
},
"description": "one act owed to the forge"
}
],
"description": "the acts the gate owes the forge",
"history": 5
},
{
"name": "turns",
"template": "state",
"key-forms": [
{
"key": "<repository>",
"value": {
"type": "object",
"properties": {
"v": {
"type": "integer",
"description": "the layout version"
},
"repository": {
"type": "string"
},
"waiting": {
"type": "array",
"items": {
"type": "object",
"properties": {
"group": {
"type": "string"
},
"heads": {
"type": "string"
},
"ask": {
"type": "string"
},
"approved": {
"type": "string",
"format": "date-time",
"description": "when (RFC 3339 time)"
},
"since": {
"type": "string",
"format": "date-time",
"description": "when (RFC 3339 time)"
},
"waits-for": {
"type": "string"
},
"waits-since": {
"type": "string",
"format": "date-time",
"description": "when (RFC 3339 time)"
},
"step": {
"type": "string"
}
},
"required": [
"group",
"heads",
"approved",
"since"
]
}
}
},
"required": [
"repository",
"waiting"
],
"description": "the merges of a repository in the order they wait for their turn"
},
"description": "the merges waiting on a repository"
}
],
"description": "which merge waits for which",
"history": 5
}
]
}
@@ -1,47 +0,0 @@
[
{
"name": "a want",
"of": "state:wants/want.<node>.<module>",
"given": {
"v": 1,
"fp": "ab12",
"rule": 3
}
},
{
"name": "a node's own want",
"of": "state:wants/want.<node>.node",
"given": {
"v": 1,
"composed": "sha256:aa",
"self": true
}
},
{
"name": "a held fingerprint",
"of": "state:wants/held.<module>.<fingerprint>",
"given": {
"v": 1,
"node": "ace"
}
},
{
"name": "a difference",
"of": "state:differences/<node>.<module>",
"given": {
"v": 1,
"want": "ab12",
"unexplained": true
}
},
{
"name": "a composition",
"of": "state:compositions/<group>.<heads>",
"given": {
"v": 1,
"group": "g1",
"heads": "0123456789ab",
"state": "pass"
}
}
]
-284
View File
@@ -1,284 +0,0 @@
{
"format": 1,
"seat": "mesh-wants",
"scope": "mesh",
"grain": "whole",
"domain": "Delivery",
"decision": "novox/hq ADR 0565, ADR 0634, ADR 0635",
"description": "The seat that says what each node should run and whether each module's new builds wait for a person (ADR 0565, ADR 0539).",
"verbs": [
{
"name": "upgrade",
"description": "Whether each module's new builds wait for a person: its policy (roll, together or record) and where it comes from (a person, the module, the bus, its irreplaceable data, the default); the bus is never rolled. With module, that one; with module, policy and why, a person's choice for it, recorded as a hand act; with policy default, the choice taken back. With compare, each node's own composition and the assigner's findings.",
"input": {
"properties": {
"compare": {
"description": "\"true\": each node's own composition, by its digest, and the assigner's findings",
"enum": [
"true",
"false"
],
"type": "string"
},
"module": {
"description": "one module",
"type": "string"
},
"policy": {
"description": "with module: roll, together, record, or default to take a person's choice back",
"type": "string"
},
"why": {
"description": "with policy: why, required and kept",
"type": "string"
}
},
"type": "object"
},
"answer": {
"type": "object",
"description": "each module's policy, or the one chosen, or the comparison"
}
},
{
"name": "bus",
"description": "What a bus upgrade would do: the fingerprint of the bus module each node runs against the indexer's newest, and the last bus steps from the hand-act log and the assigner's puts of the bus. Read-only: the step itself is the put on the operator's warrant.",
"input": {
"properties": {},
"type": "object"
},
"answer": {
"type": "object",
"description": "what a bus upgrade would do, read only"
}
}
],
"events": [
{
"name": "policy-changed",
"body": {
"type": "object"
}
}
],
"family": {
"name": "mesh-wants.events",
"max-age-days": 7
},
"states": [
{
"name": "wants",
"template": "state",
"key-forms": [
{
"key": "want.<node>.<module>",
"value": {
"type": "object",
"description": "a node's want for a module",
"properties": {
"v": {
"type": "integer"
},
"fp": {
"type": "string"
},
"composed": {
"type": "string"
},
"removed": {
"type": "boolean"
},
"newest": {
"type": "string"
},
"rule": {
"type": "integer",
"description": "the rule that holds the node back, 1 to 10"
},
"backup": {
"type": "string",
"description": "again or skip",
"enum": [
"again",
"skip"
]
},
"words": {
"type": "string"
},
"put": {
"type": "boolean"
},
"hold": {
"type": "boolean"
},
"yes": {
"type": "string"
},
"release": {
"type": "string"
},
"self": {
"type": "boolean"
}
}
},
"description": "a node's want for a module"
},
{
"key": "want.<node>.node",
"value": {
"type": "object",
"description": "a node's own want",
"properties": {
"v": {
"type": "integer"
},
"composed": {
"type": "string"
},
"words": {
"type": "string"
},
"self": {
"type": "boolean"
}
},
"required": [
"composed"
]
},
"description": "a node's own want, naming the digest of its own composition"
},
{
"key": "held.<module>.<fingerprint>",
"value": {
"type": "object",
"description": "a fingerprint the assigner holds",
"properties": {
"v": {
"type": "integer"
},
"node": {
"type": "string"
},
"words": {
"type": "string"
}
},
"required": [
"node"
]
},
"description": "a module's fingerprint the assigner holds"
}
],
"history": 20,
"description": "what each node should run, and the fingerprints held back"
},
{
"name": "differences",
"template": "state",
"key-forms": [
{
"key": "<node>.<module>",
"value": {
"type": "object",
"description": "the difference between a want and what is sent",
"properties": {
"v": {
"type": "integer"
},
"want": {
"type": "string"
},
"want-removed": {
"type": "boolean"
},
"sent": {
"type": "string"
},
"sent-build": {
"type": "string"
},
"rule": {
"type": "integer"
},
"unexplained": {
"type": "boolean"
},
"words": {
"type": "string"
}
}
},
"description": "a module on a node"
}
],
"history": 64,
"description": "differences between a want and what the node-engine is sent"
},
{
"name": "compositions",
"template": "state",
"key-forms": [
{
"key": "<group>.<heads>",
"value": {
"type": "object",
"description": "the composition verdict of a group's check at its heads",
"properties": {
"v": {
"type": "integer"
},
"group": {
"type": "string"
},
"heads": {
"type": "string",
"description": "12 lowercase hex digits"
},
"state": {
"type": "string",
"description": "pass, fail or waits"
},
"words": {
"type": "string"
},
"sdk": {
"type": "string"
},
"machines": {
"type": "array",
"items": {
"type": "string"
}
},
"machine": {
"type": "string"
},
"warnings": {
"type": "array",
"items": {
"type": "string"
}
},
"took": {
"type": "integer",
"description": "milliseconds"
}
},
"required": [
"group",
"heads",
"state"
]
},
"description": "a group's check at its heads"
}
],
"history": 5,
"description": "composition verdicts of a group's check; the checker reads them"
}
]
}
-88
View File
@@ -1,88 +0,0 @@
{
"format": 1,
"seat": "node-build-go",
"scope": "node",
"grain": "whole",
"domain": "Delivery",
"decision": "novox/hq ADR 0525, ADR 0536, ADR 0553",
"pulled-by-kind": true,
"yields": true,
"accepts": [
{
"name": "delivery",
"body": {
"$ref": "#/defs/StepAsk"
}
},
{
"name": "check",
"body": {
"$ref": "#/defs/StepAsk"
}
},
{
"name": "recheck",
"body": {
"$ref": "#/defs/StepAsk"
}
}
],
"description": "The Go build module on a node: it takes the asks of the builder and the checker, runs them as steps and answers.",
"includes": [
"build-step"
],
"states": [
{
"name": "steps",
"template": "state",
"key-forms": [
{
"key": "<node>.<id>",
"value": {
"$ref": "#/defs/Step"
},
"description": "a step on a node"
}
],
"description": "the steps this module runs",
"history": 5
},
{
"name": "pauses",
"template": "state",
"key-forms": [
{
"key": "paused.<node>",
"value": {
"$ref": "#/defs/Pause"
},
"description": "whether a node is paused"
},
{
"key": "capacity.<node>",
"value": {
"$ref": "#/defs/Capacity"
},
"description": "a node's capacity"
}
],
"description": "the pause and the capacity of each node",
"history": 1
},
{
"name": "toolchains",
"template": "state",
"key-forms": [
{
"key": "<node>.<language>",
"value": {
"$ref": "#/defs/Toolchain"
},
"description": "the toolchain a node reports"
}
],
"description": "the toolchains the nodes report",
"history": 1
}
]
}
@@ -1,63 +0,0 @@
[
{
"name": "a running step",
"of": "state:steps/<node>.<id>",
"given": {
"v": 1,
"id": "a1b2",
"tool": "build",
"node": "ace",
"state": "running",
"started": "2026-11-05T10:00:00Z"
}
},
{
"name": "a paused node",
"of": "state:pauses/paused.<node>",
"given": {
"v": 1,
"paused": true,
"by": "operator@shanks",
"at": "2026-11-05T10:00:00Z"
}
},
{
"name": "a node's capacity",
"of": "state:pauses/capacity.<node>",
"given": {
"v": 1,
"effective": 2,
"configured": 2,
"why": "the configured steps fit the cores"
}
},
{
"name": "a node's toolchain",
"of": "state:toolchains/<node>.<language>",
"given": {
"v": 1,
"language": "go",
"version": "1.26.0",
"recipe": "1"
}
},
{
"name": "a build ask",
"of": "accept:delivery",
"subject": "mesh.seat.node-build-image.accept.delivery",
"given": {
"id": "a1b2",
"kind": "build",
"language": "go",
"asker": "mesh-delivery-builder",
"build": {
"module": "nats",
"artifacts": [
{
"artifact": "go"
}
]
}
}
}
]
@@ -1,135 +0,0 @@
[
{
"name": "a running step",
"of": "state:steps/<node>.<id>",
"given": {
"v": 1,
"id": "a1b2",
"tool": "build",
"node": "ace",
"state": "running",
"started": "2026-11-05T10:00:00Z"
}
},
{
"name": "a paused node",
"of": "state:pauses/paused.<node>",
"given": {
"v": 1,
"paused": true,
"by": "operator@shanks",
"at": "2026-11-05T10:00:00Z"
}
},
{
"name": "a node's capacity",
"of": "state:pauses/capacity.<node>",
"given": {
"v": 1,
"effective": 2,
"configured": 2,
"why": "the configured steps fit the cores"
}
},
{
"name": "a node's toolchain",
"of": "state:toolchains/<node>.<language>",
"given": {
"v": 1,
"language": "go",
"version": "1.26.0",
"recipe": "1"
}
},
{
"name": "a build ask",
"of": "accept:delivery",
"subject": "mesh.seat.node-build-node.accept.delivery",
"given": {
"id": "a1b2",
"kind": "build",
"language": "go",
"asker": "mesh-delivery-builder",
"build": {
"module": "nats",
"artifacts": [
{
"artifact": "go"
}
]
}
}
},
{
"name": "a check ask with the group's tagged package",
"of": "accept:check",
"subject": "mesh.seat.node-build-node.accept.check",
"given": {
"v": 1,
"id": "c3d5",
"kind": "check",
"language": "typescript",
"asker": "mesh-delivery-checker",
"at": "2026-11-05T10:00:00Z",
"check": {
"fetch": {
"repository": "novox/mesh-delivery",
"commit": "0123456789abcdef0123456789abcdef01234567",
"ref": "refs/pull/7/head",
"base": "89abcdef0123456789abcdef0123456789abcdef",
"package": {
"name": "@novox/mesh-sdk",
"version": "0.1.15-feat-x.1"
}
},
"levels": [
"unit",
"integration"
],
"kept": true,
"toolchain": {
"language": "typescript",
"version": "26.12.0",
"recipe": "1"
},
"node-names": [
"ace",
"g14"
]
}
}
},
{
"name": "a finished check step of a TypeScript merge preview",
"of": "state:steps/<node>.<id>",
"given": {
"v": 1,
"id": "c3d6",
"tool": "check",
"node": "ace",
"state": "passed",
"started": "2026-11-05T10:00:00Z",
"ended": "2026-11-05T10:01:00Z",
"result": {
"fetch": {
"workspace": "mvii1sxt979f67",
"commit": "0123456789abcdef0123456789abcdef01234567",
"modules": [
"modules/m"
],
"base": "abcdef0123456789abcdef0123456789abcdef01",
"merge": "0123456789abcdef0123456789abcdef01234567",
"changed": [
"modules/m/package.json"
],
"trees": {
"modules/m": {
"tree": "0123456789abcdef0123456789abcdef01234567",
"manifest": "0581b699d9d05517e69b21f5cedbeb2eee8aba2b205280b561be731594d7feef"
}
}
}
}
}
}
]
@@ -1,12 +0,0 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*.ts"]
}
@@ -1,12 +0,0 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*.ts"]
}
@@ -1,12 +0,0 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*.ts"]
}
-545
View File
@@ -1,545 +0,0 @@
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// The contract of the seat "mesh-catalog", defined whole (seats/mesh-catalog/seat.json): The catalog of the mesh: every module the trunk holds with its manifest, fingerprint and verdict, the packages published, and the seat list (ADR 0636 §1, §4).
export const seat = "mesh-catalog";
export const verbs = {
modules: "modules",
module: "module",
provides: "provides",
dependents: "dependents",
seatDefinitions: "seat-definitions",
} as const;
export const events = {
seatDefinitionChanged: "seat-definition-changed",
seatDefinitionRemoved: "seat-definition-removed",
manifestAccepted: "manifest-accepted",
manifestRefused: "manifest-refused",
} as const;
export const family = { name: "mesh-catalog.events", maxAgeDays: 7 } as const;
export const seatDefinitionChangedSubject = "mesh.seat.mesh-catalog.event.seat-definition-changed";
export const seatDefinitionRemovedSubject = "mesh.seat.mesh-catalog.event.seat-definition-removed";
export const manifestAcceptedSubject = "mesh.seat.mesh-catalog.event.manifest-accepted";
export const manifestRefusedSubject = "mesh.seat.mesh-catalog.event.manifest-refused";
export const states = {
manifests: "manifests",
modules: "modules",
candidates: "candidates",
verdicts: "verdicts",
predefined: "predefined",
configCandidates: "config-candidates",
packages: "packages",
} as const;
/** The key of one value of the state manifests under the form "<digest>". */
export function manifestsByDigestKey(digest: string): string {
return digest;
}
/** The parts of a key of the form "<digest>", or undefined for a key of another form. */
export function parseManifestsByDigestKey(_key: string): { digest: string } | undefined {
let _rest = _key;
if (_rest === "") return undefined;
const digest = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { digest };
}
/** The key of one value of the state modules under the form "<module>". */
export function modulesByModuleKey(module: string): string {
return module;
}
/** The parts of a key of the form "<module>", or undefined for a key of another form. */
export function parseModulesByModuleKey(_key: string): { module: string } | undefined {
let _rest = _key;
if (_rest === "") return undefined;
const module = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { module };
}
/** The key of one value of the state candidates under the form "<group>". */
export function candidatesByGroupKey(group: string): string {
return group;
}
/** The parts of a key of the form "<group>", or undefined for a key of another form. */
export function parseCandidatesByGroupKey(_key: string): { group: string } | undefined {
let _rest = _key;
if (_rest === "") return undefined;
const group = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { group };
}
/** The key of one value of the state verdicts under the form "<digest>". */
export function verdictsByDigestKey(digest: string): string {
return digest;
}
/** The parts of a key of the form "<digest>", or undefined for a key of another form. */
export function parseVerdictsByDigestKey(_key: string): { digest: string } | undefined {
let _rest = _key;
if (_rest === "") return undefined;
const digest = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { digest };
}
/** The key of one value of the state predefined under the form "list". */
export function predefinedByListKey(): string {
return "list";
}
/** The parts of a key of the form "list", or undefined for a key of another form. */
export function parsePredefinedByListKey(_key: string): { } | undefined {
let _rest = _key;
if (!_rest.startsWith("list")) return undefined;
_rest = _rest.slice(4);
if (_rest !== "") return undefined;
return { };
}
/** The key of one value of the state config-candidates under the form "<pull>". */
export function configCandidatesByPullKey(pull: string): string {
return pull;
}
/** The parts of a key of the form "<pull>", or undefined for a key of another form. */
export function parseConfigCandidatesByPullKey(_key: string): { pull: string } | undefined {
let _rest = _key;
if (_rest === "") return undefined;
const pull = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { pull };
}
/** The key of one value of the state packages under the form "<module>". */
export function packagesByModuleKey(module: string): string {
return module;
}
/** The parts of a key of the form "<module>", or undefined for a key of another form. */
export function parsePackagesByModuleKey(_key: string): { module: string } | undefined {
let _rest = _key;
if (_rest === "") return undefined;
const module = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { module };
}
/** The key of one value of the state packages under the form "<package>.<series>". */
export function packagesByPackageSeriesKey(packagePart: string, series: string): string {
return packagePart + "." + series;
}
/** The parts of a key of the form "<package>.<series>", or undefined for a key of another form. */
export function parsePackagesByPackageSeriesKey(_key: string): { packagePart: string; series: string } | undefined {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const packagePart = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
if (_rest === "") return undefined;
const series = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { packagePart, series };
}
/** a toolchain a fingerprint was computed with (ADR 0405 clause 7) */
export interface ToolchainUsed {
"language": string;
/** the build module's recipe version */
"recipe": string;
/** the installed toolchain's version */
"version": string;
}
/** is what modules takes. */
export interface ModulesInput {
}
export interface ModulesAnswerModulesItem {
/** the merge commit it was last changed at */
"commit": string;
/** its fingerprint (src2: and 64 hex digits); absent when it has none */
"fp"?: string;
"module": string;
/** why it has none */
"none"?: string;
/** the module's directory in its repository, '.' for a root */
"path"?: string;
"repository": string;
}
/** is what modules answers. */
export interface ModulesAnswer {
"modules": ModulesAnswerModulesItem[];
}
/** is what module takes. */
export interface ModuleInput {
/** the module's name */
"module": string;
}
export interface ModuleAnswerModule {
/** the merge commit it was last changed at */
"commit": string;
/** its fingerprint (src2: and 64 hex digits); absent when it has none */
"fp"?: string;
/** the module's manifest as the trunk holds it */
"manifest"?: Record<string, unknown>;
"module": string;
/** why it has none */
"none"?: string;
/** the module's directory in its repository, '.' for a root */
"path"?: string;
"repository": string;
}
/** is what module answers. */
export interface ModuleAnswer {
"module": ModuleAnswerModule;
}
/** is what provides takes. */
export interface ProvidesInput {
/** the provision, such as postgres-database */
"provision": string;
}
/** is what provides answers. */
export type ProvidesAnswer = Record<string, unknown>;
/** is what dependents takes. */
export interface DependentsInput {
/** the module's name */
"module": string;
}
/** is what dependents answers. */
export type DependentsAnswer = Record<string, unknown>;
/** is what seat-definitions takes. */
export interface SeatDefinitionsInput {
/** the seat's name; none lists every trunk seat */
"seat"?: string;
}
export interface SeatDefinitionsAnswerEntry {
/** the definition, resolved with the parts it includes */
"definition"?: Record<string, unknown>;
"digest": string;
"seat": string;
/** trunk */
"source": string;
/** why the definition could not be read, when it could not */
"unparsed"?: string;
}
export interface SeatDefinitionsAnswerSeatsItem {
"digest": string;
"seat": string;
/** trunk */
"source": string;
}
/** is what seat-definitions answers. */
export interface SeatDefinitionsAnswer {
"entry"?: SeatDefinitionsAnswerEntry;
"found"?: boolean;
"revision"?: number;
"seat"?: string;
"seats"?: SeatDefinitionsAnswerSeatsItem[];
}
/** is the body of the event seat-definition-changed. */
export interface SeatDefinitionChangedEvent {
"digest": string;
"seat": string;
/** trunk */
"source": string;
}
/** is the body of the event seat-definition-removed. */
export interface SeatDefinitionRemovedEvent {
"seat": string;
}
export interface ManifestAcceptedEventBusStateItem {
"configuration"?: Record<string, unknown>;
"name": string;
"options"?: Record<string, unknown>;
"storage": string;
"template"?: string;
"types"?: Record<string, unknown>[];
}
/** is the body of the event manifest-accepted. */
export interface ManifestAcceptedEvent {
"bus-state": ManifestAcceptedEventBusStateItem[];
"digest": string;
"judge": string;
"module": string;
/** the indexer's revision of the verdict it says; a reader asks its first view again on a gap in it; zero from an indexer that does not say it */
"revision"?: number;
"v": number;
}
/** is the body of the event manifest-refused. */
export interface ManifestRefusedEvent {
"digest": string;
"judge": string;
"module": string;
"problems": string[];
/** the indexer's revision of the verdict it says; a reader asks its first view again on a gap in it; zero from an indexer that does not say it */
"revision"?: number;
"v": number;
}
/** is one value of the state manifests under the key <digest>. */
export interface ManifestsByDigestValue {
/** the manifest, UTF-8 JSON text */
"manifest": string;
"module": string;
/** the layout version */
"v"?: number;
}
export interface ModulesByModuleValueInputs2 {
"bases"?: string[];
"builder"?: string;
"contexts"?: Record<string, string>;
"import-form"?: string;
"imports"?: string[];
"locks"?: Record<string, string>;
"packages"?: string[];
"paths"?: Record<string, string>;
"tree": string;
}
/** is one value of the state modules under the key <module>. */
export interface ModulesByModuleValue {
"commit": string;
/** the old-form fingerprint */
"fp"?: string;
"fp-src"?: number;
/** src2: fingerprint */
"fp2"?: string;
"inputs2"?: ModulesByModuleValueInputs2;
/** manifest digest */
"manifest"?: string;
"needs"?: string[];
"none"?: string;
/** why it has none */
"none2"?: string;
"packages"?: Record<string, string>;
"path"?: string;
"paths"?: Record<string, string[]>;
"problems"?: string[];
"repository": string;
/** the source revision */
"src"?: number;
/** by language: the toolchain FP2 was computed with */
"toolchains"?: Record<string, ToolchainUsed>;
"unknown"?: string[];
/** the layout version */
"v"?: number;
"verdict"?: string;
"warnings"?: string[];
}
export interface CandidatesByGroupValuePullsItemFpsValue {
"fp2"?: string;
"manifest"?: string;
"none2"?: string;
"packages"?: Record<string, string>;
"paths"?: Record<string, string>;
}
export interface CandidatesByGroupValuePullsItem {
"fps"?: Record<string, CandidatesByGroupValuePullsItemFpsValue>;
"head": string;
"modules": string[];
"number": number;
"repository": string;
}
/** is one value of the state candidates under the key <group>. */
export interface CandidatesByGroupValue {
/** the source revision it is read on */
"base": number;
"fpset"?: string;
"group": string;
"heads": string;
"pulls": CandidatesByGroupValuePullsItem[];
/** the layout version */
"v"?: number;
}
/** is one value of the state verdicts under the key <digest>. */
export interface VerdictsByDigestValue {
/** when (RFC 3339 time) */
"at"?: string;
"judge"?: string;
"module": string;
"problems"?: string[];
"state": string;
"unknown"?: string[];
/** the layout version */
"v"?: number;
"warnings"?: string[];
}
/** is one value of the state predefined under the key list. */
export interface PredefinedByListValue {
/** when (RFC 3339 time) */
"at"?: string;
"commit": string;
/** the foundation's predefined list as kept */
"list": unknown;
/** the layout version */
"v"?: number;
}
export interface ConfigCandidatesByPullValueDeclaresValueValue {
/** the default */
"default": unknown;
"description"?: string;
/** the allowed values */
"enum"?: unknown;
"kind": string;
/** a declared bound; 0 is a bound, absent is none */
"maximum"?: number | null;
/** a declared bound; 0 is a bound, absent is none */
"minimum"?: number | null;
"pattern"?: string;
"predefined"?: string;
"required"?: boolean;
"runtime"?: boolean;
"trusted"?: boolean;
"type"?: string;
"why": string;
}
/** is one value of the state config-candidates under the key <pull>. */
export interface ConfigCandidatesByPullValue {
/** when (RFC 3339 time) */
"at"?: string;
/** module to key to declaration */
"declares": Record<string, Record<string, ConfigCandidatesByPullValueDeclaresValueValue>>;
"head": string;
"pull": string;
/** the layout version */
"v"?: number;
}
export interface PackagesByModuleValuePackagesItem {
"digest": string;
"package": string;
}
/** is one value of the state packages under the key <module>. */
export interface PackagesByModuleValue {
/** when (RFC 3339 time) */
"at"?: string;
"commit": string;
"dir"?: string;
/** the Go module path */
"module": string;
"packages": PackagesByModuleValuePackagesItem[];
"repository": string;
/** digest of go.mod and go.sum */
"requires"?: string;
/** the layout version */
"v"?: number;
}
export interface PackagesByPackageSeriesValueNewestContentsPackagesItem {
"digest": string;
"package": string;
}
export interface PackagesByPackageSeriesValueNewestContents {
/** when (RFC 3339 time) */
"at"?: string;
"commit": string;
"dir"?: string;
/** the Go module path */
"module": string;
"packages": PackagesByPackageSeriesValueNewestContentsPackagesItem[];
"repository": string;
/** digest of go.mod and go.sum */
"requires"?: string;
/** the layout version */
"v"?: number;
}
export interface PackagesByPackageSeriesValueNewest {
"commit"?: string;
"contents"?: PackagesByPackageSeriesValueNewestContents;
"digest"?: string;
"fingerprint"?: string;
"version": string;
}
export interface PackagesByPackageSeriesValueNumberedContentsPackagesItem {
"digest": string;
"package": string;
}
export interface PackagesByPackageSeriesValueNumberedContents {
/** when (RFC 3339 time) */
"at"?: string;
"commit": string;
"dir"?: string;
/** the Go module path */
"module": string;
"packages": PackagesByPackageSeriesValueNumberedContentsPackagesItem[];
"repository": string;
/** digest of go.mod and go.sum */
"requires"?: string;
/** the layout version */
"v"?: number;
}
export interface PackagesByPackageSeriesValueNumbered {
"commit"?: string;
"contents"?: PackagesByPackageSeriesValueNumberedContents;
"digest"?: string;
"fingerprint"?: string;
"version": string;
}
/** is one value of the state packages under the key <package>.<series>. */
export interface PackagesByPackageSeriesValue {
/** when (RFC 3339 time) */
"at"?: string;
"go-module"?: string;
"name": string;
"newest"?: PackagesByPackageSeriesValueNewest;
"numbered"?: PackagesByPackageSeriesValueNumbered;
"package"?: string;
"seat"?: string;
"series": string;
/** the layout version */
"v"?: number;
}
@@ -1,12 +0,0 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*.ts"]
}
@@ -1,338 +0,0 @@
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// The contract of the seat "mesh-delivery", defined whole (seats/mesh-delivery/seat.json): The delivery gate: reads and steers deliveries, merges and the checks that decide them; the merge is made on the operator's Approve once both checks passed.
export const seat = "mesh-delivery";
export const verbs = {
deliveries: "deliveries",
times: "times",
show: "show",
groups: "groups",
whatIf: "what-if",
checks: "checks",
table: "table",
stalled: "stalled",
recheck: "recheck",
release: "release",
stop: "stop",
close: "close",
retireHistory: "retire-history",
settle: "settle",
} as const;
export const states = {
source: "source",
merges: "merges",
asks: "asks",
owed: "owed",
turns: "turns",
} as const;
/** The key of one value of the state source under the form "main". */
export function sourceByMainKey(): string {
return "main";
}
/** The parts of a key of the form "main", or undefined for a key of another form. */
export function parseSourceByMainKey(_key: string): { } | undefined {
let _rest = _key;
if (!_rest.startsWith("main")) return undefined;
_rest = _rest.slice(4);
if (_rest !== "") return undefined;
return { };
}
/** The key of one value of the state merges under the form "<group>". */
export function mergesByGroupKey(group: string): string {
return group;
}
/** The parts of a key of the form "<group>", or undefined for a key of another form. */
export function parseMergesByGroupKey(_key: string): { group: string } | undefined {
let _rest = _key;
if (_rest === "") return undefined;
const group = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { group };
}
/** The key of one value of the state asks under the form "merge.<group>.<heads>". */
export function asksByMergeGroupHeadsKey(group: string, heads: string): string {
return "merge." + group + "." + heads;
}
/** The parts of a key of the form "merge.<group>.<heads>", or undefined for a key of another form. */
export function parseAsksByMergeGroupHeadsKey(_key: string): { group: string; heads: string } | undefined {
let _rest = _key;
if (!_rest.startsWith("merge.")) return undefined;
_rest = _rest.slice(6);
const _at1 = _rest.indexOf(".");
if (_at1 <= 0) return undefined;
const group = _rest.slice(0, _at1);
_rest = _rest.slice(_at1 + 1);
if (_rest === "") return undefined;
const heads = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { group, heads };
}
/** The key of one value of the state owed under the form "<repository>.<number>.<head>.<act>". */
export function owedByRepositoryNumberHeadActKey(repository: string, number: string, head: string, act: string): string {
return repository + "." + number + "." + head + "." + act;
}
/** The parts of a key of the form "<repository>.<number>.<head>.<act>", or undefined for a key of another form. */
export function parseOwedByRepositoryNumberHeadActKey(_key: string): { repository: string; number: string; head: string; act: string } | undefined {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const repository = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
const _at2 = _rest.indexOf(".");
if (_at2 <= 0) return undefined;
const number = _rest.slice(0, _at2);
_rest = _rest.slice(_at2 + 1);
const _at4 = _rest.indexOf(".");
if (_at4 <= 0) return undefined;
const head = _rest.slice(0, _at4);
_rest = _rest.slice(_at4 + 1);
if (_rest === "") return undefined;
const act = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { repository, number, head, act };
}
/** The key of one value of the state turns under the form "<repository>". */
export function turnsByRepositoryKey(repository: string): string {
return repository;
}
/** The parts of a key of the form "<repository>", or undefined for a key of another form. */
export function parseTurnsByRepositoryKey(_key: string): { repository: string } | undefined {
let _rest = _key;
if (_rest === "") return undefined;
const repository = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { repository };
}
/** is what deliveries takes. */
export interface DeliveriesInput {
/** "true": the final ones of the last thirty days too */
"all"?: "true" | "false";
/** a group's id (its branch name) */
"group"?: string;
/** owner/repository */
"repository"?: string;
/** one state, e.g. delivering or held */
"state"?: string;
}
/** is what deliveries answers. */
export type DeliveriesAnswer = Record<string, unknown>;
/** is what times takes. */
export interface TimesInput {
}
/** is what times answers. */
export type TimesAnswer = Record<string, unknown>;
/** is what show takes. */
export interface ShowInput {
/** a delivery's id, or a group's */
"id": string;
}
/** is what show answers. */
export type ShowAnswer = Record<string, unknown>;
/** is what groups takes. */
export interface GroupsInput {
/** "true": the groups that ended too */
"all"?: "true" | "false";
}
/** is what groups answers. */
export type GroupsAnswer = Record<string, unknown>;
/** is what what-if takes. */
export interface WhatIfInput {
}
/** is what what-if answers. */
export type WhatIfAnswer = Record<string, unknown>;
/** is what checks takes. */
export interface ChecksInput {
/** a commit's sha, or the start of one, instead of a pull request */
"commit"?: string;
/** a pull request's number: its head is read */
"number"?: string;
/** owner/repository */
"repository": string;
}
/** is what checks answers. */
export type ChecksAnswer = Record<string, unknown>;
/** is what table takes. */
export interface TableInput {
}
/** is what table answers. */
export type TableAnswer = Record<string, unknown>;
/** is what stalled takes. */
export interface StalledInput {
}
/** is what stalled answers. */
export type StalledAnswer = Record<string, unknown>;
/** is what recheck takes. */
export interface RecheckInput {
/** the delivery's id */
"id": string;
/** why, kept with the transition */
"why": string;
}
/** is what recheck answers. */
export type RecheckAnswer = Record<string, unknown>;
/** is what release takes. */
export interface ReleaseInput {
}
/** is what release answers. */
export type ReleaseAnswer = Record<string, unknown>;
/** is what stop takes. */
export interface StopInput {
}
/** is what stop answers. */
export type StopAnswer = Record<string, unknown>;
/** is what close takes. */
export interface CloseInput {
/** the delivery's id */
"id": string;
/** the condition it answers */
"why": string;
}
/** is what close answers. */
export type CloseAnswer = Record<string, unknown>;
/** is what retire-history takes. */
export interface RetireHistoryInput {
}
/** is what retire-history answers. */
export type RetireHistoryAnswer = Record<string, unknown>;
/** is what settle takes. */
export interface SettleInput {
/** the held deliveries' ids (owner/repository@commit) */
"ids": string[];
/** why they may be settled, shown to the operator */
"why": string;
}
/** is what settle answers. */
export type SettleAnswer = Record<string, unknown>;
/** is one value of the state source under the key main. */
export interface SourceByMainValue {
/** the group that moved it */
"group": string;
/** repository to the merged head, a full commit */
"heads": Record<string, string>;
/** the layout version */
"v"?: number;
}
export interface MergesByGroupValuePullsItem {
"commit"?: string;
"head": string;
"number": number;
"repository": string;
/** merging, merged or refused */
"state": string;
"words"?: string;
}
/** is one value of the state merges under the key <group>. */
export interface MergesByGroupValue {
/** <repository>@<number> to the approved head */
"approved"?: Record<string, string>;
/** the ask key */
"ask": string;
"group": string;
"pulls": MergesByGroupValuePullsItem[];
/** the layout version */
"v"?: number;
}
export interface AsksByMergeGroupHeadsValueHeadsItem {
/** the full commit */
"head": string;
"number": number;
/** <owner>/<name> */
"repository": string;
}
/** is one value of the state asks under the key merge.<group>.<heads>. */
export interface AsksByMergeGroupHeadsValue {
/** the operator-channel ask as raised */
"ask": unknown;
/** the number of times it was asked */
"asking"?: number;
"group": string;
"heads": AsksByMergeGroupHeadsValueHeadsItem[];
/** the layout version */
"v"?: number;
}
/** is one value of the state owed under the key <repository>.<number>.<head>.<act>. */
export interface OwedByRepositoryNumberHeadActValue {
/** status=<context>, view, note or comment.<seq> */
"act": string;
"context"?: string;
"ref"?: string;
"state"?: string;
"target"?: string;
"text"?: string;
/** the layout version */
"v"?: number;
}
export interface TurnsByRepositoryValueWaitingItem {
/** when (RFC 3339 time) */
"approved": string;
"ask"?: string;
"group": string;
"heads": string;
/** when (RFC 3339 time) */
"since": string;
"step"?: string;
"waits-for"?: string;
/** when (RFC 3339 time) */
"waits-since"?: string;
}
/** is one value of the state turns under the key <repository>. */
export interface TurnsByRepositoryValue {
"repository": string;
/** the layout version */
"v"?: number;
"waiting": TurnsByRepositoryValueWaitingItem[];
}
@@ -1,12 +0,0 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*.ts"]
}
@@ -1,12 +0,0 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*.ts"]
}
-211
View File
@@ -1,211 +0,0 @@
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// The contract of the seat "mesh-wants", defined whole (seats/mesh-wants/seat.json): The seat that says what each node should run and whether each module's new builds wait for a person (ADR 0565, ADR 0539).
export const seat = "mesh-wants";
export const verbs = {
upgrade: "upgrade",
bus: "bus",
} as const;
export const events = {
policyChanged: "policy-changed",
} as const;
export const family = { name: "mesh-wants.events", maxAgeDays: 7 } as const;
export const policyChangedSubject = "mesh.seat.mesh-wants.event.policy-changed";
export const states = {
wants: "wants",
differences: "differences",
compositions: "compositions",
} as const;
/** The key of one value of the state wants under the form "want.<node>.<module>". */
export function wantsByWantNodeModuleKey(node: string, module: string): string {
return "want." + node + "." + module;
}
/** The parts of a key of the form "want.<node>.<module>", or undefined for a key of another form. */
export function parseWantsByWantNodeModuleKey(_key: string): { node: string; module: string } | undefined {
let _rest = _key;
if (!_rest.startsWith("want.")) return undefined;
_rest = _rest.slice(5);
const _at1 = _rest.indexOf(".");
if (_at1 <= 0) return undefined;
const node = _rest.slice(0, _at1);
_rest = _rest.slice(_at1 + 1);
if (_rest === "") return undefined;
const module = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node, module };
}
/** The key of one value of the state wants under the form "want.<node>.node". */
export function wantsByWantNodeNodeKey(node: string): string {
return "want." + node + ".node";
}
/** The parts of a key of the form "want.<node>.node", or undefined for a key of another form. */
export function parseWantsByWantNodeNodeKey(_key: string): { node: string } | undefined {
let _rest = _key;
if (!_rest.startsWith("want.")) return undefined;
_rest = _rest.slice(5);
const _at1 = _rest.indexOf(".node");
if (_at1 <= 0) return undefined;
const node = _rest.slice(0, _at1);
_rest = _rest.slice(_at1 + 5);
if (_rest !== "") return undefined;
return { node };
}
/** The key of one value of the state wants under the form "held.<module>.<fingerprint>". */
export function wantsByHeldModuleFingerprintKey(module: string, fingerprint: string): string {
return "held." + module + "." + fingerprint;
}
/** The parts of a key of the form "held.<module>.<fingerprint>", or undefined for a key of another form. */
export function parseWantsByHeldModuleFingerprintKey(_key: string): { module: string; fingerprint: string } | undefined {
let _rest = _key;
if (!_rest.startsWith("held.")) return undefined;
_rest = _rest.slice(5);
const _at1 = _rest.indexOf(".");
if (_at1 <= 0) return undefined;
const module = _rest.slice(0, _at1);
_rest = _rest.slice(_at1 + 1);
if (_rest === "") return undefined;
const fingerprint = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { module, fingerprint };
}
/** The key of one value of the state differences under the form "<node>.<module>". */
export function differencesByNodeModuleKey(node: string, module: string): string {
return node + "." + module;
}
/** The parts of a key of the form "<node>.<module>", or undefined for a key of another form. */
export function parseDifferencesByNodeModuleKey(_key: string): { node: string; module: string } | undefined {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const node = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
if (_rest === "") return undefined;
const module = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node, module };
}
/** The key of one value of the state compositions under the form "<group>.<heads>". */
export function compositionsByGroupHeadsKey(group: string, heads: string): string {
return group + "." + heads;
}
/** The parts of a key of the form "<group>.<heads>", or undefined for a key of another form. */
export function parseCompositionsByGroupHeadsKey(_key: string): { group: string; heads: string } | undefined {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const group = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
if (_rest === "") return undefined;
const heads = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { group, heads };
}
/** is what upgrade takes. */
export interface UpgradeInput {
/** "true": each node's own composition, by its digest, and the assigner's findings */
"compare"?: "true" | "false";
/** one module */
"module"?: string;
/** with module: roll, together, record, or default to take a person's choice back */
"policy"?: string;
/** with policy: why, required and kept */
"why"?: string;
}
/** is what upgrade answers. */
export type UpgradeAnswer = Record<string, unknown>;
/** is what bus takes. */
export interface BusInput {
}
/** is what bus answers. */
export type BusAnswer = Record<string, unknown>;
/** is the body of the event policy-changed. */
export type PolicyChangedEvent = Record<string, unknown>;
/** is one value of the state wants under the key want.<node>.<module>. */
export interface WantsByWantNodeModuleValue {
/** again or skip */
"backup"?: "again" | "skip";
"composed"?: string;
"fp"?: string;
"hold"?: boolean;
"newest"?: string;
"put"?: boolean;
"release"?: string;
"removed"?: boolean;
/** the rule that holds the node back, 1 to 10 */
"rule"?: number;
"self"?: boolean;
"v"?: number;
"words"?: string;
"yes"?: string;
}
/** is one value of the state wants under the key want.<node>.node. */
export interface WantsByWantNodeNodeValue {
"composed": string;
"self"?: boolean;
"v"?: number;
"words"?: string;
}
/** is one value of the state wants under the key held.<module>.<fingerprint>. */
export interface WantsByHeldModuleFingerprintValue {
"node": string;
"v"?: number;
"words"?: string;
}
/** is one value of the state differences under the key <node>.<module>. */
export interface DifferencesByNodeModuleValue {
"rule"?: number;
"sent"?: string;
"sent-build"?: string;
"unexplained"?: boolean;
"v"?: number;
"want"?: string;
"want-removed"?: boolean;
"words"?: string;
}
/** is one value of the state compositions under the key <group>.<heads>. */
export interface CompositionsByGroupHeadsValue {
"group": string;
/** 12 lowercase hex digits */
"heads": string;
"machine"?: string;
"machines"?: string[];
"sdk"?: string;
/** pass, fail or waits */
"state": string;
/** milliseconds */
"took"?: number;
"v"?: number;
"warnings"?: string[];
"words"?: string;
}
@@ -1,12 +0,0 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*.ts"]
}
-167
View File
@@ -1,167 +0,0 @@
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// The contract of the seat "node-build-go", defined whole (seats/node-build-go/seat.json): The Go build module on a node: it takes the asks of the builder and the checker, runs them as steps and answers.
import type * as buildStep from "./parts/build-step.js";
export const seat = "node-build-go";
export const verbs = {
current: "current",
pause: "pause",
resume: "resume",
} as const;
export const accepts = {
delivery: "delivery",
check: "check",
recheck: "recheck",
} as const;
export const deliverySubject = "mesh.seat.node-build-go.accept.delivery";
export const checkSubject = "mesh.seat.node-build-go.accept.check";
export const recheckSubject = "mesh.seat.node-build-go.accept.recheck";
export const states = {
steps: "steps",
pauses: "pauses",
toolchains: "toolchains",
} as const;
/** The key of one value of the state steps under the form "<node>.<id>". */
export function stepsByNodeIDKey(node: string, id: string): string {
return node + "." + id;
}
/** The parts of a key of the form "<node>.<id>", or undefined for a key of another form. */
export function parseStepsByNodeIDKey(_key: string): { node: string; id: string } | undefined {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const node = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
if (_rest === "") return undefined;
const id = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node, id };
}
/** The key of one value of the state pauses under the form "paused.<node>". */
export function pausesByPausedNodeKey(node: string): string {
return "paused." + node;
}
/** The parts of a key of the form "paused.<node>", or undefined for a key of another form. */
export function parsePausesByPausedNodeKey(_key: string): { node: string } | undefined {
let _rest = _key;
if (!_rest.startsWith("paused.")) return undefined;
_rest = _rest.slice(7);
if (_rest === "") return undefined;
const node = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node };
}
/** The key of one value of the state pauses under the form "capacity.<node>". */
export function pausesByCapacityNodeKey(node: string): string {
return "capacity." + node;
}
/** The parts of a key of the form "capacity.<node>", or undefined for a key of another form. */
export function parsePausesByCapacityNodeKey(_key: string): { node: string } | undefined {
let _rest = _key;
if (!_rest.startsWith("capacity.")) return undefined;
_rest = _rest.slice(9);
if (_rest === "") return undefined;
const node = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node };
}
/** The key of one value of the state toolchains under the form "<node>.<language>". */
export function toolchainsByNodeLanguageKey(node: string, language: string): string {
return node + "." + language;
}
/** The parts of a key of the form "<node>.<language>", or undefined for a key of another form. */
export function parseToolchainsByNodeLanguageKey(_key: string): { node: string; language: string } | undefined {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const node = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
if (_rest === "") return undefined;
const language = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node, language };
}
export type AskArtifact = buildStep.AskArtifact;
export type BuildAnswer = buildStep.BuildAnswer;
export type BuiltArtifact = buildStep.BuiltArtifact;
export type Capacity = buildStep.Capacity;
export type CheckAnswer = buildStep.CheckAnswer;
export type ComposeAnswer = buildStep.ComposeAnswer;
export type CurrentAnswer = buildStep.CurrentAnswer;
export type CurrentInput = buildStep.CurrentInput;
export type Fetch = buildStep.Fetch;
export type FetchAnswer = buildStep.FetchAnswer;
export type FetchBesideItem = buildStep.FetchBesideItem;
export type FetchPackage = buildStep.FetchPackage;
export type FetchRefusal = buildStep.FetchRefusal;
export type LevelAnswer = buildStep.LevelAnswer;
export type LevelAnswerDigest = buildStep.LevelAnswerDigest;
export type LevelAnswerDigestNeedsItem = buildStep.LevelAnswerDigestNeedsItem;
export type LevelAnswerDigestPackagesItem = buildStep.LevelAnswerDigestPackagesItem;
export type LevelAnswerKeptItem = buildStep.LevelAnswerKeptItem;
export type LevelAnswerUnmetItem = buildStep.LevelAnswerUnmetItem;
export type ModuleTree = buildStep.ModuleTree;
export type Pause = buildStep.Pause;
export type PauseAnswer = buildStep.PauseAnswer;
export type PauseInput = buildStep.PauseInput;
export type PlacedBeside = buildStep.PlacedBeside;
export type Program = buildStep.Program;
export type ResumeAnswer = buildStep.ResumeAnswer;
export type ResumeInput = buildStep.ResumeInput;
export type RunAnswer = buildStep.RunAnswer;
export type RunHead = buildStep.RunHead;
export type RunInput = buildStep.RunInput;
export type RunJob = buildStep.RunJob;
export type RunProgram = buildStep.RunProgram;
export type Step = buildStep.Step;
export type StepAsk = buildStep.StepAsk;
export type StepAskBuild = buildStep.StepAskBuild;
export type StepAskCheck = buildStep.StepAskCheck;
export type StepAskCompose = buildStep.StepAskCompose;
export type StepResult = buildStep.StepResult;
export type TakenVersion = buildStep.TakenVersion;
export type Toolchain = buildStep.Toolchain;
export type ToolchainUsed = buildStep.ToolchainUsed;
/** is the body of delivery. */
export type DeliveryAccept = StepAsk;
/** is the body of check. */
export type CheckAccept = StepAsk;
/** is the body of recheck. */
export type RecheckAccept = StepAsk;
/** is one value of the state steps under the key <node>.<id>. */
export type StepsByNodeIDValue = Step;
/** is one value of the state pauses under the key paused.<node>. */
export type PausesByPausedNodeValue = Pause;
/** is one value of the state pauses under the key capacity.<node>. */
export type PausesByCapacityNodeValue = Capacity;
/** is one value of the state toolchains under the key <node>.<language>. */
export type ToolchainsByNodeLanguageValue = Toolchain;
@@ -1,398 +0,0 @@
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// The part "build-step" several seats include whole: What the three build seats share: the verbs that read and steer a node's builds, and the layouts of the asks they accept and the steps they keep. A seat lists its states against these (a part carries no states).
export const verbs = {
current: "current",
pause: "pause",
resume: "resume",
} as const;
/** one artifact of a build ask: built from the fetched tree, or copied from an upstream pin */
export interface AskArtifact {
"artifact": string;
"from"?: string;
"seat"?: string;
"version"?: string;
}
export interface BuildAnswer {
"artifacts": BuiltArtifact[];
"imports"?: string[];
"out-of-step"?: string[];
"toolchain"?: ToolchainUsed;
}
/** one artifact a build made: its digest and the reference it was published under */
export interface BuiltArtifact {
"artifact": string;
"digest": string;
"reference"?: string;
}
/** how many steps the node runs at once */
export interface Capacity {
/** when (RFC 3339 time) */
"at"?: string;
"build-hours"?: string;
"build-hours-fault"?: string;
"by-cpu"?: number;
"configured": number;
"configured-from"?: string;
"cores-per-step"?: number;
"effective": number;
"ineligible"?: string;
"outside-hours"?: boolean;
"quota-cores"?: number;
"quota-from"?: string;
/** the layout version */
"v"?: number;
"why": string;
}
export interface CheckAnswer {
"fetch": FetchAnswer;
"levels"?: LevelAnswer[];
}
export interface ComposeAnswer {
"built": boolean;
"key"?: string;
/** the compose-candidate verdict */
"verdict"?: unknown;
}
export interface FetchBesideItem {
"commit": string;
"repository": string;
}
/** the TypeScript module's group package: the group's tagged version of the SDK ({name, version}), placed from the registry in each member whatever its lock names, or the group's package member ({repository, commit, ref}), packed by the fetch and served to the members in place of the registry's */
export interface FetchPackage {
"commit"?: string;
"name"?: string;
"ref"?: string;
"repository"?: string;
"version"?: string;
}
/** what a build module's fetch tool is asked: the repository and the full commit, the pull request's ref when only its head carries the commit, the trunk commit to merge onto for a merge preview, the module's directory and named paths, the mesh packages to build against, and the sibling repositories placed beside */
export interface Fetch {
/** the trunk commit a merge preview merges onto */
"base"?: string;
/** the sibling repositories placed beside the fetched tree */
"beside"?: FetchBesideItem[];
/** the full commit */
"commit": string;
/** the module's directory in the repository ("." for its root), with paths */
"dir"?: string;
/** the TypeScript module's group package: the group's tagged version of the SDK ({name, version}), placed from the registry in each member whatever its lock names, or the group's package member ({repository, commit, ref}), packed by the fetch and served to the members in place of the registry's */
"package"?: FetchPackage;
/** the version (a full commit) of each mesh package to build against, by its module path */
"packages"?: Record<string, string>;
/** the paths the module names, relative to dir */
"paths"?: string[];
/** the pull request's ref, when only its head carries the commit */
"ref"?: string;
/** <owner>/<name> */
"repository": string;
}
/** what a build module's fetch tool answers, whole: the workspace it made, the commit in it, the module directories found; and, when the call gave a base, the merge preview (the trunk commit, the merge commit, the files that conflict, the paths the merge changes, the compiled programs among them, the tree of each module directory). A head that does not merge cleanly is an answer, not an error: merge is empty and conflicts names the files. The Go module adds the sibling repositories placed and the package versions taken; the TypeScript module the directories installed and refused and the group's package */
export interface FetchAnswer {
"base"?: string;
"beside"?: PlacedBeside[];
"changed"?: string[];
"commit": string;
"conflicts"?: string[];
"group"?: string;
"installed"?: string[];
"merge"?: string;
"modules": string[];
"packages"?: TakenVersion[];
"programs"?: Program[];
"refused"?: FetchRefusal[];
"trees"?: Record<string, ModuleTree>;
"workspace": string;
}
/** a TypeScript module whose packages the fetch did not install, with why */
export interface FetchRefusal {
"module": string;
"reason": string;
}
export interface LevelAnswerDigestNeedsItem {
"needs"?: string[];
"package"?: string;
}
export interface LevelAnswerDigestPackagesItem {
"digest": string;
"package": string;
}
export interface LevelAnswerDigest {
"beside"?: string[];
"judged_by"?: string;
"level"?: string;
"needs"?: LevelAnswerDigestNeedsItem[];
"packages"?: LevelAnswerDigestPackagesItem[];
"without_tests"?: string[];
}
export interface LevelAnswerKeptItem {
"digest"?: string;
"package"?: string;
"tests"?: number;
}
export interface LevelAnswerUnmetItem {
"needs"?: string[];
"package"?: string;
}
/** one level of a check ask: the digest's answer, the kept verdicts taken, one test result per test step run, and the packages the node could not test */
export interface LevelAnswer {
"digest"?: LevelAnswerDigest;
"judged"?: string;
"kept"?: LevelAnswerKeptItem[];
"level": string;
"tests"?: unknown[];
"unmet"?: LevelAnswerUnmetItem[];
}
/** the tree of one module directory in a merge preview: its git tree, the digest of its manifest, the lock files' digests and the digests of the named paths */
export interface ModuleTree {
"locks"?: Record<string, string>;
"manifest": string;
/** no longer filled (ADR 0593 section 2); kept so a preview written before still reads */
"packages"?: string[];
"paths"?: Record<string, string>;
"tree": string;
}
/** whether the node takes no new ask */
export interface Pause {
/** when (RFC 3339 time) */
"at"?: string;
"by"?: string;
"paused": boolean;
/** the layout version */
"v"?: number;
}
/** a sibling repository placed as a plain directory under the workspace's beside directory */
export interface PlacedBeside {
"commit": string;
"dir": string;
"repository": string;
}
/** a changed file that is a compiled program (issue 1577): its path, its executable format, and the commit of the branch that added it when the merge's tree no longer holds it */
export interface Program {
"commit"?: string;
/** ELF, Mach-O or PE */
"kind": string;
"path": string;
}
/** what a run ask's step answers: whether this run built the program or took the one kept under its key, the key, the program's exit, the last line of its standard output and the first of its standard error */
export interface RunAnswer {
"built": boolean;
"exit": number;
"key": string;
/** raw when it is JSON, else a JSON string */
"output"?: unknown;
"said"?: string;
}
/** one commit a run's program reads */
export interface RunHead {
"commit": string;
"repository": string;
}
/** a run's input by reference: the seat verb the asker serves it on (seat:<seat>.<verb>), the sha256 of its bytes and its size, at most 256 KiB */
export interface RunInput {
/** 64 lowercase hex digits */
"digest": string;
/** bytes */
"size": number;
"verb": string;
}
/** a run ask's job: where its program is built, the heads it reads (each laid read-only at its repository's path), its input by reference, its arguments and what it is for */
export interface RunJob {
/** the program's arguments, each a word or a flag */
"args"?: string[];
/** the commits the program reads, a repository at most once */
"heads": RunHead[];
"input": RunInput;
"program": RunProgram;
/** what the run is for, for a reader of the ask */
"reader"?: string;
}
/** where a run's program is built: the repository and full commit fetched, the Go module's directory in it and the program's import path */
export interface RunProgram {
"commit": string;
"dir": string;
"package": string;
"repository": string;
}
/** one step a build module runs on a node */
export interface Step {
/** when (RFC 3339 time) */
"ended"?: string;
"id": string;
"node": string;
"owner"?: string;
"phase"?: string;
/** when (RFC 3339 time) */
"phase-at"?: string;
"reason"?: string;
"result"?: StepResult;
/** when (RFC 3339 time) */
"started": string;
/** running, passed, failed or refused */
"state": string;
"tool": string;
/** the layout version */
"v"?: number;
"what"?: string;
}
export interface StepAskBuild {
"artifacts": AskArtifact[];
"fetch"?: Fetch;
"fp"?: string;
"module": string;
"path"?: string;
"publish"?: boolean;
"toolchain"?: ToolchainUsed;
}
export interface StepAskCheck {
"fetch": Fetch;
"kept"?: boolean;
"levels": string[];
/** the node names the check's tests run against */
"node-names"?: string[];
"packages"?: string[];
"run"?: string;
"runner"?: string;
"runner_when"?: string;
/** the toolchain the checker agreed for the language (ADR 0584 clause 2): a node on another declines the check */
"toolchain"?: ToolchainUsed;
}
export interface StepAskCompose {
"dir": string;
"fetch": Fetch;
"package": string;
"reader"?: string;
/** the compose-candidate request */
"request": unknown;
}
/** one ask of a build module */
export interface StepAsk {
"asker": string;
/** when (RFC 3339 time) */
"at"?: string;
"build"?: StepAskBuild;
"check"?: StepAskCheck;
"compose"?: StepAskCompose;
"id": string;
/** build, check or compose */
"kind": string;
/** go, typescript or image */
"language": string;
"needs"?: string[];
/** package to the tagged version a build pins */
"packages"?: Record<string, string>;
/** a run: a program built from a change and run in the build seat's sandbox over the heads, its input asked of a verb of the asker's seat; the Go seat's check stream alone carries it, as a compose */
"run"?: RunJob;
/** the layout version */
"v"?: number;
}
/** what a step answered, by the kind of ask: a build's artifacts, toolchain, imports and out-of-step modules; a check's fetch and levels; a compose's built, key and verdict; a run's built, key, exit, output and said; a declined ask's declined, needs and lacks. The fields of the kinds do not meet, so one layout holds the five */
export interface StepResult {
"artifacts"?: BuiltArtifact[];
"built"?: boolean;
/** the holder declined the ask: its node lacks what the ask needs */
"declined"?: boolean;
/** a run's program's exit status */
"exit"?: number;
"fetch"?: FetchAnswer;
"imports"?: string[];
"key"?: string;
/** what the holder's node lacks of it */
"lacks"?: string[];
"levels"?: LevelAnswer[];
/** what the declined ask needs */
"needs"?: string[];
"out-of-step"?: string[];
/** a run's program's last line of standard output: raw when it is JSON, else a JSON string */
"output"?: unknown;
/** a run's program's first line of standard error, or why the step could not run it */
"said"?: string;
"toolchain"?: ToolchainUsed;
/** the compose-candidate verdict (the composer's own layout) */
"verdict"?: unknown;
}
/** of a directory whose go.mod requires an asked mesh package, the version it is built against: the asked one, or go.mod's when it names a newer one, said */
export interface TakenVersion {
"asked": string;
"built": string;
"dir": string;
"named": string;
"package": string;
"said"?: string;
"sum"?: string;
}
/** the toolchain a node reports */
export interface Toolchain {
/** when (RFC 3339 time) */
"at"?: string;
/** go or typescript */
"language": string;
"recipe": string;
/** the layout version */
"v"?: number;
"version": string;
}
/** the toolchain a build was made with: the language, the installed version and the build module's recipe */
export interface ToolchainUsed {
"language": string;
"recipe": string;
"version": string;
}
/** is what current takes. */
export interface CurrentInput {
}
/** is what current answers. */
export type CurrentAnswer = Record<string, unknown>;
/** is what pause takes. */
export interface PauseInput {
}
/** is what pause answers. */
export type PauseAnswer = Record<string, unknown>;
/** is what resume takes. */
export interface ResumeInput {
}
/** is what resume answers. */
export type ResumeAnswer = Record<string, unknown>;
@@ -1,12 +0,0 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*.ts"]
}
@@ -1,167 +0,0 @@
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// The contract of the seat "node-build-image", defined whole (seats/node-build-image/seat.json): The image build module on a node: it takes the asks of the builder and the checker, runs them as steps and answers.
import type * as buildStep from "./parts/build-step.js";
export const seat = "node-build-image";
export const verbs = {
current: "current",
pause: "pause",
resume: "resume",
} as const;
export const accepts = {
delivery: "delivery",
check: "check",
recheck: "recheck",
} as const;
export const deliverySubject = "mesh.seat.node-build-image.accept.delivery";
export const checkSubject = "mesh.seat.node-build-image.accept.check";
export const recheckSubject = "mesh.seat.node-build-image.accept.recheck";
export const states = {
steps: "steps",
pauses: "pauses",
toolchains: "toolchains",
} as const;
/** The key of one value of the state steps under the form "<node>.<id>". */
export function stepsByNodeIDKey(node: string, id: string): string {
return node + "." + id;
}
/** The parts of a key of the form "<node>.<id>", or undefined for a key of another form. */
export function parseStepsByNodeIDKey(_key: string): { node: string; id: string } | undefined {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const node = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
if (_rest === "") return undefined;
const id = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node, id };
}
/** The key of one value of the state pauses under the form "paused.<node>". */
export function pausesByPausedNodeKey(node: string): string {
return "paused." + node;
}
/** The parts of a key of the form "paused.<node>", or undefined for a key of another form. */
export function parsePausesByPausedNodeKey(_key: string): { node: string } | undefined {
let _rest = _key;
if (!_rest.startsWith("paused.")) return undefined;
_rest = _rest.slice(7);
if (_rest === "") return undefined;
const node = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node };
}
/** The key of one value of the state pauses under the form "capacity.<node>". */
export function pausesByCapacityNodeKey(node: string): string {
return "capacity." + node;
}
/** The parts of a key of the form "capacity.<node>", or undefined for a key of another form. */
export function parsePausesByCapacityNodeKey(_key: string): { node: string } | undefined {
let _rest = _key;
if (!_rest.startsWith("capacity.")) return undefined;
_rest = _rest.slice(9);
if (_rest === "") return undefined;
const node = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node };
}
/** The key of one value of the state toolchains under the form "<node>.<language>". */
export function toolchainsByNodeLanguageKey(node: string, language: string): string {
return node + "." + language;
}
/** The parts of a key of the form "<node>.<language>", or undefined for a key of another form. */
export function parseToolchainsByNodeLanguageKey(_key: string): { node: string; language: string } | undefined {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const node = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
if (_rest === "") return undefined;
const language = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node, language };
}
export type AskArtifact = buildStep.AskArtifact;
export type BuildAnswer = buildStep.BuildAnswer;
export type BuiltArtifact = buildStep.BuiltArtifact;
export type Capacity = buildStep.Capacity;
export type CheckAnswer = buildStep.CheckAnswer;
export type ComposeAnswer = buildStep.ComposeAnswer;
export type CurrentAnswer = buildStep.CurrentAnswer;
export type CurrentInput = buildStep.CurrentInput;
export type Fetch = buildStep.Fetch;
export type FetchAnswer = buildStep.FetchAnswer;
export type FetchBesideItem = buildStep.FetchBesideItem;
export type FetchPackage = buildStep.FetchPackage;
export type FetchRefusal = buildStep.FetchRefusal;
export type LevelAnswer = buildStep.LevelAnswer;
export type LevelAnswerDigest = buildStep.LevelAnswerDigest;
export type LevelAnswerDigestNeedsItem = buildStep.LevelAnswerDigestNeedsItem;
export type LevelAnswerDigestPackagesItem = buildStep.LevelAnswerDigestPackagesItem;
export type LevelAnswerKeptItem = buildStep.LevelAnswerKeptItem;
export type LevelAnswerUnmetItem = buildStep.LevelAnswerUnmetItem;
export type ModuleTree = buildStep.ModuleTree;
export type Pause = buildStep.Pause;
export type PauseAnswer = buildStep.PauseAnswer;
export type PauseInput = buildStep.PauseInput;
export type PlacedBeside = buildStep.PlacedBeside;
export type Program = buildStep.Program;
export type ResumeAnswer = buildStep.ResumeAnswer;
export type ResumeInput = buildStep.ResumeInput;
export type RunAnswer = buildStep.RunAnswer;
export type RunHead = buildStep.RunHead;
export type RunInput = buildStep.RunInput;
export type RunJob = buildStep.RunJob;
export type RunProgram = buildStep.RunProgram;
export type Step = buildStep.Step;
export type StepAsk = buildStep.StepAsk;
export type StepAskBuild = buildStep.StepAskBuild;
export type StepAskCheck = buildStep.StepAskCheck;
export type StepAskCompose = buildStep.StepAskCompose;
export type StepResult = buildStep.StepResult;
export type TakenVersion = buildStep.TakenVersion;
export type Toolchain = buildStep.Toolchain;
export type ToolchainUsed = buildStep.ToolchainUsed;
/** is the body of delivery. */
export type DeliveryAccept = StepAsk;
/** is the body of check. */
export type CheckAccept = StepAsk;
/** is the body of recheck. */
export type RecheckAccept = StepAsk;
/** is one value of the state steps under the key <node>.<id>. */
export type StepsByNodeIDValue = Step;
/** is one value of the state pauses under the key paused.<node>. */
export type PausesByPausedNodeValue = Pause;
/** is one value of the state pauses under the key capacity.<node>. */
export type PausesByCapacityNodeValue = Capacity;
/** is one value of the state toolchains under the key <node>.<language>. */
export type ToolchainsByNodeLanguageValue = Toolchain;
@@ -1,398 +0,0 @@
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// The part "build-step" several seats include whole: What the three build seats share: the verbs that read and steer a node's builds, and the layouts of the asks they accept and the steps they keep. A seat lists its states against these (a part carries no states).
export const verbs = {
current: "current",
pause: "pause",
resume: "resume",
} as const;
/** one artifact of a build ask: built from the fetched tree, or copied from an upstream pin */
export interface AskArtifact {
"artifact": string;
"from"?: string;
"seat"?: string;
"version"?: string;
}
export interface BuildAnswer {
"artifacts": BuiltArtifact[];
"imports"?: string[];
"out-of-step"?: string[];
"toolchain"?: ToolchainUsed;
}
/** one artifact a build made: its digest and the reference it was published under */
export interface BuiltArtifact {
"artifact": string;
"digest": string;
"reference"?: string;
}
/** how many steps the node runs at once */
export interface Capacity {
/** when (RFC 3339 time) */
"at"?: string;
"build-hours"?: string;
"build-hours-fault"?: string;
"by-cpu"?: number;
"configured": number;
"configured-from"?: string;
"cores-per-step"?: number;
"effective": number;
"ineligible"?: string;
"outside-hours"?: boolean;
"quota-cores"?: number;
"quota-from"?: string;
/** the layout version */
"v"?: number;
"why": string;
}
export interface CheckAnswer {
"fetch": FetchAnswer;
"levels"?: LevelAnswer[];
}
export interface ComposeAnswer {
"built": boolean;
"key"?: string;
/** the compose-candidate verdict */
"verdict"?: unknown;
}
export interface FetchBesideItem {
"commit": string;
"repository": string;
}
/** the TypeScript module's group package: the group's tagged version of the SDK ({name, version}), placed from the registry in each member whatever its lock names, or the group's package member ({repository, commit, ref}), packed by the fetch and served to the members in place of the registry's */
export interface FetchPackage {
"commit"?: string;
"name"?: string;
"ref"?: string;
"repository"?: string;
"version"?: string;
}
/** what a build module's fetch tool is asked: the repository and the full commit, the pull request's ref when only its head carries the commit, the trunk commit to merge onto for a merge preview, the module's directory and named paths, the mesh packages to build against, and the sibling repositories placed beside */
export interface Fetch {
/** the trunk commit a merge preview merges onto */
"base"?: string;
/** the sibling repositories placed beside the fetched tree */
"beside"?: FetchBesideItem[];
/** the full commit */
"commit": string;
/** the module's directory in the repository ("." for its root), with paths */
"dir"?: string;
/** the TypeScript module's group package: the group's tagged version of the SDK ({name, version}), placed from the registry in each member whatever its lock names, or the group's package member ({repository, commit, ref}), packed by the fetch and served to the members in place of the registry's */
"package"?: FetchPackage;
/** the version (a full commit) of each mesh package to build against, by its module path */
"packages"?: Record<string, string>;
/** the paths the module names, relative to dir */
"paths"?: string[];
/** the pull request's ref, when only its head carries the commit */
"ref"?: string;
/** <owner>/<name> */
"repository": string;
}
/** what a build module's fetch tool answers, whole: the workspace it made, the commit in it, the module directories found; and, when the call gave a base, the merge preview (the trunk commit, the merge commit, the files that conflict, the paths the merge changes, the compiled programs among them, the tree of each module directory). A head that does not merge cleanly is an answer, not an error: merge is empty and conflicts names the files. The Go module adds the sibling repositories placed and the package versions taken; the TypeScript module the directories installed and refused and the group's package */
export interface FetchAnswer {
"base"?: string;
"beside"?: PlacedBeside[];
"changed"?: string[];
"commit": string;
"conflicts"?: string[];
"group"?: string;
"installed"?: string[];
"merge"?: string;
"modules": string[];
"packages"?: TakenVersion[];
"programs"?: Program[];
"refused"?: FetchRefusal[];
"trees"?: Record<string, ModuleTree>;
"workspace": string;
}
/** a TypeScript module whose packages the fetch did not install, with why */
export interface FetchRefusal {
"module": string;
"reason": string;
}
export interface LevelAnswerDigestNeedsItem {
"needs"?: string[];
"package"?: string;
}
export interface LevelAnswerDigestPackagesItem {
"digest": string;
"package": string;
}
export interface LevelAnswerDigest {
"beside"?: string[];
"judged_by"?: string;
"level"?: string;
"needs"?: LevelAnswerDigestNeedsItem[];
"packages"?: LevelAnswerDigestPackagesItem[];
"without_tests"?: string[];
}
export interface LevelAnswerKeptItem {
"digest"?: string;
"package"?: string;
"tests"?: number;
}
export interface LevelAnswerUnmetItem {
"needs"?: string[];
"package"?: string;
}
/** one level of a check ask: the digest's answer, the kept verdicts taken, one test result per test step run, and the packages the node could not test */
export interface LevelAnswer {
"digest"?: LevelAnswerDigest;
"judged"?: string;
"kept"?: LevelAnswerKeptItem[];
"level": string;
"tests"?: unknown[];
"unmet"?: LevelAnswerUnmetItem[];
}
/** the tree of one module directory in a merge preview: its git tree, the digest of its manifest, the lock files' digests and the digests of the named paths */
export interface ModuleTree {
"locks"?: Record<string, string>;
"manifest": string;
/** no longer filled (ADR 0593 section 2); kept so a preview written before still reads */
"packages"?: string[];
"paths"?: Record<string, string>;
"tree": string;
}
/** whether the node takes no new ask */
export interface Pause {
/** when (RFC 3339 time) */
"at"?: string;
"by"?: string;
"paused": boolean;
/** the layout version */
"v"?: number;
}
/** a sibling repository placed as a plain directory under the workspace's beside directory */
export interface PlacedBeside {
"commit": string;
"dir": string;
"repository": string;
}
/** a changed file that is a compiled program (issue 1577): its path, its executable format, and the commit of the branch that added it when the merge's tree no longer holds it */
export interface Program {
"commit"?: string;
/** ELF, Mach-O or PE */
"kind": string;
"path": string;
}
/** what a run ask's step answers: whether this run built the program or took the one kept under its key, the key, the program's exit, the last line of its standard output and the first of its standard error */
export interface RunAnswer {
"built": boolean;
"exit": number;
"key": string;
/** raw when it is JSON, else a JSON string */
"output"?: unknown;
"said"?: string;
}
/** one commit a run's program reads */
export interface RunHead {
"commit": string;
"repository": string;
}
/** a run's input by reference: the seat verb the asker serves it on (seat:<seat>.<verb>), the sha256 of its bytes and its size, at most 256 KiB */
export interface RunInput {
/** 64 lowercase hex digits */
"digest": string;
/** bytes */
"size": number;
"verb": string;
}
/** a run ask's job: where its program is built, the heads it reads (each laid read-only at its repository's path), its input by reference, its arguments and what it is for */
export interface RunJob {
/** the program's arguments, each a word or a flag */
"args"?: string[];
/** the commits the program reads, a repository at most once */
"heads": RunHead[];
"input": RunInput;
"program": RunProgram;
/** what the run is for, for a reader of the ask */
"reader"?: string;
}
/** where a run's program is built: the repository and full commit fetched, the Go module's directory in it and the program's import path */
export interface RunProgram {
"commit": string;
"dir": string;
"package": string;
"repository": string;
}
/** one step a build module runs on a node */
export interface Step {
/** when (RFC 3339 time) */
"ended"?: string;
"id": string;
"node": string;
"owner"?: string;
"phase"?: string;
/** when (RFC 3339 time) */
"phase-at"?: string;
"reason"?: string;
"result"?: StepResult;
/** when (RFC 3339 time) */
"started": string;
/** running, passed, failed or refused */
"state": string;
"tool": string;
/** the layout version */
"v"?: number;
"what"?: string;
}
export interface StepAskBuild {
"artifacts": AskArtifact[];
"fetch"?: Fetch;
"fp"?: string;
"module": string;
"path"?: string;
"publish"?: boolean;
"toolchain"?: ToolchainUsed;
}
export interface StepAskCheck {
"fetch": Fetch;
"kept"?: boolean;
"levels": string[];
/** the node names the check's tests run against */
"node-names"?: string[];
"packages"?: string[];
"run"?: string;
"runner"?: string;
"runner_when"?: string;
/** the toolchain the checker agreed for the language (ADR 0584 clause 2): a node on another declines the check */
"toolchain"?: ToolchainUsed;
}
export interface StepAskCompose {
"dir": string;
"fetch": Fetch;
"package": string;
"reader"?: string;
/** the compose-candidate request */
"request": unknown;
}
/** one ask of a build module */
export interface StepAsk {
"asker": string;
/** when (RFC 3339 time) */
"at"?: string;
"build"?: StepAskBuild;
"check"?: StepAskCheck;
"compose"?: StepAskCompose;
"id": string;
/** build, check or compose */
"kind": string;
/** go, typescript or image */
"language": string;
"needs"?: string[];
/** package to the tagged version a build pins */
"packages"?: Record<string, string>;
/** a run: a program built from a change and run in the build seat's sandbox over the heads, its input asked of a verb of the asker's seat; the Go seat's check stream alone carries it, as a compose */
"run"?: RunJob;
/** the layout version */
"v"?: number;
}
/** what a step answered, by the kind of ask: a build's artifacts, toolchain, imports and out-of-step modules; a check's fetch and levels; a compose's built, key and verdict; a run's built, key, exit, output and said; a declined ask's declined, needs and lacks. The fields of the kinds do not meet, so one layout holds the five */
export interface StepResult {
"artifacts"?: BuiltArtifact[];
"built"?: boolean;
/** the holder declined the ask: its node lacks what the ask needs */
"declined"?: boolean;
/** a run's program's exit status */
"exit"?: number;
"fetch"?: FetchAnswer;
"imports"?: string[];
"key"?: string;
/** what the holder's node lacks of it */
"lacks"?: string[];
"levels"?: LevelAnswer[];
/** what the declined ask needs */
"needs"?: string[];
"out-of-step"?: string[];
/** a run's program's last line of standard output: raw when it is JSON, else a JSON string */
"output"?: unknown;
/** a run's program's first line of standard error, or why the step could not run it */
"said"?: string;
"toolchain"?: ToolchainUsed;
/** the compose-candidate verdict (the composer's own layout) */
"verdict"?: unknown;
}
/** of a directory whose go.mod requires an asked mesh package, the version it is built against: the asked one, or go.mod's when it names a newer one, said */
export interface TakenVersion {
"asked": string;
"built": string;
"dir": string;
"named": string;
"package": string;
"said"?: string;
"sum"?: string;
}
/** the toolchain a node reports */
export interface Toolchain {
/** when (RFC 3339 time) */
"at"?: string;
/** go or typescript */
"language": string;
"recipe": string;
/** the layout version */
"v"?: number;
"version": string;
}
/** the toolchain a build was made with: the language, the installed version and the build module's recipe */
export interface ToolchainUsed {
"language": string;
"recipe": string;
"version": string;
}
/** is what current takes. */
export interface CurrentInput {
}
/** is what current answers. */
export type CurrentAnswer = Record<string, unknown>;
/** is what pause takes. */
export interface PauseInput {
}
/** is what pause answers. */
export type PauseAnswer = Record<string, unknown>;
/** is what resume takes. */
export interface ResumeInput {
}
/** is what resume answers. */
export type ResumeAnswer = Record<string, unknown>;
@@ -1,12 +0,0 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*.ts"]
}
@@ -1,167 +0,0 @@
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// The contract of the seat "node-build-node", defined whole (seats/node-build-node/seat.json): The Node build module on a node: it takes the asks of the builder and the checker, runs them as steps and answers.
import type * as buildStep from "./parts/build-step.js";
export const seat = "node-build-node";
export const verbs = {
current: "current",
pause: "pause",
resume: "resume",
} as const;
export const accepts = {
delivery: "delivery",
check: "check",
recheck: "recheck",
} as const;
export const deliverySubject = "mesh.seat.node-build-node.accept.delivery";
export const checkSubject = "mesh.seat.node-build-node.accept.check";
export const recheckSubject = "mesh.seat.node-build-node.accept.recheck";
export const states = {
steps: "steps",
pauses: "pauses",
toolchains: "toolchains",
} as const;
/** The key of one value of the state steps under the form "<node>.<id>". */
export function stepsByNodeIDKey(node: string, id: string): string {
return node + "." + id;
}
/** The parts of a key of the form "<node>.<id>", or undefined for a key of another form. */
export function parseStepsByNodeIDKey(_key: string): { node: string; id: string } | undefined {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const node = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
if (_rest === "") return undefined;
const id = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node, id };
}
/** The key of one value of the state pauses under the form "paused.<node>". */
export function pausesByPausedNodeKey(node: string): string {
return "paused." + node;
}
/** The parts of a key of the form "paused.<node>", or undefined for a key of another form. */
export function parsePausesByPausedNodeKey(_key: string): { node: string } | undefined {
let _rest = _key;
if (!_rest.startsWith("paused.")) return undefined;
_rest = _rest.slice(7);
if (_rest === "") return undefined;
const node = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node };
}
/** The key of one value of the state pauses under the form "capacity.<node>". */
export function pausesByCapacityNodeKey(node: string): string {
return "capacity." + node;
}
/** The parts of a key of the form "capacity.<node>", or undefined for a key of another form. */
export function parsePausesByCapacityNodeKey(_key: string): { node: string } | undefined {
let _rest = _key;
if (!_rest.startsWith("capacity.")) return undefined;
_rest = _rest.slice(9);
if (_rest === "") return undefined;
const node = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node };
}
/** The key of one value of the state toolchains under the form "<node>.<language>". */
export function toolchainsByNodeLanguageKey(node: string, language: string): string {
return node + "." + language;
}
/** The parts of a key of the form "<node>.<language>", or undefined for a key of another form. */
export function parseToolchainsByNodeLanguageKey(_key: string): { node: string; language: string } | undefined {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const node = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
if (_rest === "") return undefined;
const language = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { node, language };
}
export type AskArtifact = buildStep.AskArtifact;
export type BuildAnswer = buildStep.BuildAnswer;
export type BuiltArtifact = buildStep.BuiltArtifact;
export type Capacity = buildStep.Capacity;
export type CheckAnswer = buildStep.CheckAnswer;
export type ComposeAnswer = buildStep.ComposeAnswer;
export type CurrentAnswer = buildStep.CurrentAnswer;
export type CurrentInput = buildStep.CurrentInput;
export type Fetch = buildStep.Fetch;
export type FetchAnswer = buildStep.FetchAnswer;
export type FetchBesideItem = buildStep.FetchBesideItem;
export type FetchPackage = buildStep.FetchPackage;
export type FetchRefusal = buildStep.FetchRefusal;
export type LevelAnswer = buildStep.LevelAnswer;
export type LevelAnswerDigest = buildStep.LevelAnswerDigest;
export type LevelAnswerDigestNeedsItem = buildStep.LevelAnswerDigestNeedsItem;
export type LevelAnswerDigestPackagesItem = buildStep.LevelAnswerDigestPackagesItem;
export type LevelAnswerKeptItem = buildStep.LevelAnswerKeptItem;
export type LevelAnswerUnmetItem = buildStep.LevelAnswerUnmetItem;
export type ModuleTree = buildStep.ModuleTree;
export type Pause = buildStep.Pause;
export type PauseAnswer = buildStep.PauseAnswer;
export type PauseInput = buildStep.PauseInput;
export type PlacedBeside = buildStep.PlacedBeside;
export type Program = buildStep.Program;
export type ResumeAnswer = buildStep.ResumeAnswer;
export type ResumeInput = buildStep.ResumeInput;
export type RunAnswer = buildStep.RunAnswer;
export type RunHead = buildStep.RunHead;
export type RunInput = buildStep.RunInput;
export type RunJob = buildStep.RunJob;
export type RunProgram = buildStep.RunProgram;
export type Step = buildStep.Step;
export type StepAsk = buildStep.StepAsk;
export type StepAskBuild = buildStep.StepAskBuild;
export type StepAskCheck = buildStep.StepAskCheck;
export type StepAskCompose = buildStep.StepAskCompose;
export type StepResult = buildStep.StepResult;
export type TakenVersion = buildStep.TakenVersion;
export type Toolchain = buildStep.Toolchain;
export type ToolchainUsed = buildStep.ToolchainUsed;
/** is the body of delivery. */
export type DeliveryAccept = StepAsk;
/** is the body of check. */
export type CheckAccept = StepAsk;
/** is the body of recheck. */
export type RecheckAccept = StepAsk;
/** is one value of the state steps under the key <node>.<id>. */
export type StepsByNodeIDValue = Step;
/** is one value of the state pauses under the key paused.<node>. */
export type PausesByPausedNodeValue = Pause;
/** is one value of the state pauses under the key capacity.<node>. */
export type PausesByCapacityNodeValue = Capacity;
/** is one value of the state toolchains under the key <node>.<language>. */
export type ToolchainsByNodeLanguageValue = Toolchain;
@@ -1,398 +0,0 @@
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// The part "build-step" several seats include whole: What the three build seats share: the verbs that read and steer a node's builds, and the layouts of the asks they accept and the steps they keep. A seat lists its states against these (a part carries no states).
export const verbs = {
current: "current",
pause: "pause",
resume: "resume",
} as const;
/** one artifact of a build ask: built from the fetched tree, or copied from an upstream pin */
export interface AskArtifact {
"artifact": string;
"from"?: string;
"seat"?: string;
"version"?: string;
}
export interface BuildAnswer {
"artifacts": BuiltArtifact[];
"imports"?: string[];
"out-of-step"?: string[];
"toolchain"?: ToolchainUsed;
}
/** one artifact a build made: its digest and the reference it was published under */
export interface BuiltArtifact {
"artifact": string;
"digest": string;
"reference"?: string;
}
/** how many steps the node runs at once */
export interface Capacity {
/** when (RFC 3339 time) */
"at"?: string;
"build-hours"?: string;
"build-hours-fault"?: string;
"by-cpu"?: number;
"configured": number;
"configured-from"?: string;
"cores-per-step"?: number;
"effective": number;
"ineligible"?: string;
"outside-hours"?: boolean;
"quota-cores"?: number;
"quota-from"?: string;
/** the layout version */
"v"?: number;
"why": string;
}
export interface CheckAnswer {
"fetch": FetchAnswer;
"levels"?: LevelAnswer[];
}
export interface ComposeAnswer {
"built": boolean;
"key"?: string;
/** the compose-candidate verdict */
"verdict"?: unknown;
}
export interface FetchBesideItem {
"commit": string;
"repository": string;
}
/** the TypeScript module's group package: the group's tagged version of the SDK ({name, version}), placed from the registry in each member whatever its lock names, or the group's package member ({repository, commit, ref}), packed by the fetch and served to the members in place of the registry's */
export interface FetchPackage {
"commit"?: string;
"name"?: string;
"ref"?: string;
"repository"?: string;
"version"?: string;
}
/** what a build module's fetch tool is asked: the repository and the full commit, the pull request's ref when only its head carries the commit, the trunk commit to merge onto for a merge preview, the module's directory and named paths, the mesh packages to build against, and the sibling repositories placed beside */
export interface Fetch {
/** the trunk commit a merge preview merges onto */
"base"?: string;
/** the sibling repositories placed beside the fetched tree */
"beside"?: FetchBesideItem[];
/** the full commit */
"commit": string;
/** the module's directory in the repository ("." for its root), with paths */
"dir"?: string;
/** the TypeScript module's group package: the group's tagged version of the SDK ({name, version}), placed from the registry in each member whatever its lock names, or the group's package member ({repository, commit, ref}), packed by the fetch and served to the members in place of the registry's */
"package"?: FetchPackage;
/** the version (a full commit) of each mesh package to build against, by its module path */
"packages"?: Record<string, string>;
/** the paths the module names, relative to dir */
"paths"?: string[];
/** the pull request's ref, when only its head carries the commit */
"ref"?: string;
/** <owner>/<name> */
"repository": string;
}
/** what a build module's fetch tool answers, whole: the workspace it made, the commit in it, the module directories found; and, when the call gave a base, the merge preview (the trunk commit, the merge commit, the files that conflict, the paths the merge changes, the compiled programs among them, the tree of each module directory). A head that does not merge cleanly is an answer, not an error: merge is empty and conflicts names the files. The Go module adds the sibling repositories placed and the package versions taken; the TypeScript module the directories installed and refused and the group's package */
export interface FetchAnswer {
"base"?: string;
"beside"?: PlacedBeside[];
"changed"?: string[];
"commit": string;
"conflicts"?: string[];
"group"?: string;
"installed"?: string[];
"merge"?: string;
"modules": string[];
"packages"?: TakenVersion[];
"programs"?: Program[];
"refused"?: FetchRefusal[];
"trees"?: Record<string, ModuleTree>;
"workspace": string;
}
/** a TypeScript module whose packages the fetch did not install, with why */
export interface FetchRefusal {
"module": string;
"reason": string;
}
export interface LevelAnswerDigestNeedsItem {
"needs"?: string[];
"package"?: string;
}
export interface LevelAnswerDigestPackagesItem {
"digest": string;
"package": string;
}
export interface LevelAnswerDigest {
"beside"?: string[];
"judged_by"?: string;
"level"?: string;
"needs"?: LevelAnswerDigestNeedsItem[];
"packages"?: LevelAnswerDigestPackagesItem[];
"without_tests"?: string[];
}
export interface LevelAnswerKeptItem {
"digest"?: string;
"package"?: string;
"tests"?: number;
}
export interface LevelAnswerUnmetItem {
"needs"?: string[];
"package"?: string;
}
/** one level of a check ask: the digest's answer, the kept verdicts taken, one test result per test step run, and the packages the node could not test */
export interface LevelAnswer {
"digest"?: LevelAnswerDigest;
"judged"?: string;
"kept"?: LevelAnswerKeptItem[];
"level": string;
"tests"?: unknown[];
"unmet"?: LevelAnswerUnmetItem[];
}
/** the tree of one module directory in a merge preview: its git tree, the digest of its manifest, the lock files' digests and the digests of the named paths */
export interface ModuleTree {
"locks"?: Record<string, string>;
"manifest": string;
/** no longer filled (ADR 0593 section 2); kept so a preview written before still reads */
"packages"?: string[];
"paths"?: Record<string, string>;
"tree": string;
}
/** whether the node takes no new ask */
export interface Pause {
/** when (RFC 3339 time) */
"at"?: string;
"by"?: string;
"paused": boolean;
/** the layout version */
"v"?: number;
}
/** a sibling repository placed as a plain directory under the workspace's beside directory */
export interface PlacedBeside {
"commit": string;
"dir": string;
"repository": string;
}
/** a changed file that is a compiled program (issue 1577): its path, its executable format, and the commit of the branch that added it when the merge's tree no longer holds it */
export interface Program {
"commit"?: string;
/** ELF, Mach-O or PE */
"kind": string;
"path": string;
}
/** what a run ask's step answers: whether this run built the program or took the one kept under its key, the key, the program's exit, the last line of its standard output and the first of its standard error */
export interface RunAnswer {
"built": boolean;
"exit": number;
"key": string;
/** raw when it is JSON, else a JSON string */
"output"?: unknown;
"said"?: string;
}
/** one commit a run's program reads */
export interface RunHead {
"commit": string;
"repository": string;
}
/** a run's input by reference: the seat verb the asker serves it on (seat:<seat>.<verb>), the sha256 of its bytes and its size, at most 256 KiB */
export interface RunInput {
/** 64 lowercase hex digits */
"digest": string;
/** bytes */
"size": number;
"verb": string;
}
/** a run ask's job: where its program is built, the heads it reads (each laid read-only at its repository's path), its input by reference, its arguments and what it is for */
export interface RunJob {
/** the program's arguments, each a word or a flag */
"args"?: string[];
/** the commits the program reads, a repository at most once */
"heads": RunHead[];
"input": RunInput;
"program": RunProgram;
/** what the run is for, for a reader of the ask */
"reader"?: string;
}
/** where a run's program is built: the repository and full commit fetched, the Go module's directory in it and the program's import path */
export interface RunProgram {
"commit": string;
"dir": string;
"package": string;
"repository": string;
}
/** one step a build module runs on a node */
export interface Step {
/** when (RFC 3339 time) */
"ended"?: string;
"id": string;
"node": string;
"owner"?: string;
"phase"?: string;
/** when (RFC 3339 time) */
"phase-at"?: string;
"reason"?: string;
"result"?: StepResult;
/** when (RFC 3339 time) */
"started": string;
/** running, passed, failed or refused */
"state": string;
"tool": string;
/** the layout version */
"v"?: number;
"what"?: string;
}
export interface StepAskBuild {
"artifacts": AskArtifact[];
"fetch"?: Fetch;
"fp"?: string;
"module": string;
"path"?: string;
"publish"?: boolean;
"toolchain"?: ToolchainUsed;
}
export interface StepAskCheck {
"fetch": Fetch;
"kept"?: boolean;
"levels": string[];
/** the node names the check's tests run against */
"node-names"?: string[];
"packages"?: string[];
"run"?: string;
"runner"?: string;
"runner_when"?: string;
/** the toolchain the checker agreed for the language (ADR 0584 clause 2): a node on another declines the check */
"toolchain"?: ToolchainUsed;
}
export interface StepAskCompose {
"dir": string;
"fetch": Fetch;
"package": string;
"reader"?: string;
/** the compose-candidate request */
"request": unknown;
}
/** one ask of a build module */
export interface StepAsk {
"asker": string;
/** when (RFC 3339 time) */
"at"?: string;
"build"?: StepAskBuild;
"check"?: StepAskCheck;
"compose"?: StepAskCompose;
"id": string;
/** build, check or compose */
"kind": string;
/** go, typescript or image */
"language": string;
"needs"?: string[];
/** package to the tagged version a build pins */
"packages"?: Record<string, string>;
/** a run: a program built from a change and run in the build seat's sandbox over the heads, its input asked of a verb of the asker's seat; the Go seat's check stream alone carries it, as a compose */
"run"?: RunJob;
/** the layout version */
"v"?: number;
}
/** what a step answered, by the kind of ask: a build's artifacts, toolchain, imports and out-of-step modules; a check's fetch and levels; a compose's built, key and verdict; a run's built, key, exit, output and said; a declined ask's declined, needs and lacks. The fields of the kinds do not meet, so one layout holds the five */
export interface StepResult {
"artifacts"?: BuiltArtifact[];
"built"?: boolean;
/** the holder declined the ask: its node lacks what the ask needs */
"declined"?: boolean;
/** a run's program's exit status */
"exit"?: number;
"fetch"?: FetchAnswer;
"imports"?: string[];
"key"?: string;
/** what the holder's node lacks of it */
"lacks"?: string[];
"levels"?: LevelAnswer[];
/** what the declined ask needs */
"needs"?: string[];
"out-of-step"?: string[];
/** a run's program's last line of standard output: raw when it is JSON, else a JSON string */
"output"?: unknown;
/** a run's program's first line of standard error, or why the step could not run it */
"said"?: string;
"toolchain"?: ToolchainUsed;
/** the compose-candidate verdict (the composer's own layout) */
"verdict"?: unknown;
}
/** of a directory whose go.mod requires an asked mesh package, the version it is built against: the asked one, or go.mod's when it names a newer one, said */
export interface TakenVersion {
"asked": string;
"built": string;
"dir": string;
"named": string;
"package": string;
"said"?: string;
"sum"?: string;
}
/** the toolchain a node reports */
export interface Toolchain {
/** when (RFC 3339 time) */
"at"?: string;
/** go or typescript */
"language": string;
"recipe": string;
/** the layout version */
"v"?: number;
"version": string;
}
/** the toolchain a build was made with: the language, the installed version and the build module's recipe */
export interface ToolchainUsed {
"language": string;
"recipe": string;
"version": string;
}
/** is what current takes. */
export interface CurrentInput {
}
/** is what current answers. */
export type CurrentAnswer = Record<string, unknown>;
/** is what pause takes. */
export interface PauseInput {
}
/** is what pause answers. */
export type PauseAnswer = Record<string, unknown>;
/** is what resume takes. */
export interface ResumeInput {
}
/** is what resume answers. */
export type ResumeAnswer = Record<string, unknown>;
@@ -1,12 +0,0 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*.ts"]
}
@@ -1,12 +0,0 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*.ts"]
}
@@ -1,12 +0,0 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*.ts"]
}
+48 -12
View File
@@ -16,10 +16,10 @@ import (
"git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient"
"git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
"git.novox.be/novox/mesh-delivery/contracts/go/clients/meshcatalogclient"
"git.novox.be/novox/mesh-delivery/contracts/go/clients/meshdeliveryclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
"git.novox.be/novox/mesh-delivery/sdk/kept"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshdeliveryclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/catalogkey"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/kept"
"git.novox.be/novox/mesh-sdk/go/keys"
)
@@ -38,10 +38,16 @@ const (
// `assignments.<proposal id>`. The kind needs no proof, as the bus's put does not: its yes is an Approve, which only a
// channel proving who answered takes and the view never does (ViewAnswerFits).
AskKindAssignments = "assignments"
// AskKindOutside is the kind of the assigner's ask about a moved module whose failing health check has waited past its bound
// on an outside cause (design 47 G §706): go on, or count it as failed. `outside.<node>.<module>.<fingerprint hex>`.
AskKindOutside = "outside"
// AskKindRevert is the kind of the assigner's ask about a held revert, one with no restore point (design 47 G §710): keep it
// held, or start the reverted build on the live data. `revert.<node>.<module>.<fingerprint hex>`, the reverted build's.
AskKindRevert = "revert"
)
// AskKey is an ask's key read whole: its Kind, and the parts its kind has: a merge's Group and heads Hash, a hold's Module
// and fingerprint FP, a restore's and a backup's Node, Module and FP, a record's Node, Module and the digest Composed of the
// and fingerprint FP, a restore's, a backup's, an outside's and a revert's Node, Module and FP, a record's Node, Module and the digest Composed of the
// composition it would allow, the assignments' Proposal.
type AskKey struct {
Proposal string
@@ -60,11 +66,11 @@ func AskNeedsProof(kind string) (bool, error) {
switch kind {
case meshdeliveryclient.AskKindMerge:
return true, nil
case AskKindHold, AskKindRestore, AskKindBackup, AskKindRecord, AskKindAssignments:
case AskKindHold, AskKindRestore, AskKindBackup, AskKindRecord, AskKindAssignments, AskKindOutside, AskKindRevert:
return false, nil
}
return false, fmt.Errorf("asks: %q is not a kind of ask, %s, %s, %s, %s, %s or %s", kind, meshdeliveryclient.AskKindMerge, AskKindHold,
AskKindRestore, AskKindBackup, AskKindRecord, AskKindAssignments)
return false, fmt.Errorf("asks: %q is not a kind of ask, %s, %s, %s, %s, %s, %s, %s or %s", kind, meshdeliveryclient.AskKindMerge, AskKindHold,
AskKindRestore, AskKindBackup, AskKindRecord, AskKindAssignments, AskKindOutside, AskKindRevert)
}
// HoldAskKey is the key of the ask about a module's held fingerprint: `hold.<module>.<hex>`.
@@ -89,10 +95,23 @@ func RestoreAskKey(node, module, fingerprint string) (string, error) {
return AskKindRestore + "." + node + "." + key, nil
}
// OutsideAskKey is the key of the ask about a module's failing check on a node that waited past its bound on an outside cause:
// `outside.<node>.<module>.<hex>`.
func OutsideAskKey(node, module, fingerprint string) (string, error) {
key, err := RestoreAskKey(node, module, fingerprint)
if err != nil {
return "", err
}
return AskKindOutside + strings.TrimPrefix(key, AskKindRestore), nil
}
// OutsideAbout is what the outside ask is about: `<node>.<module>.<hex>` (design 47 G §706).
func OutsideAbout(key string) string { return strings.TrimPrefix(key, AskKindOutside+".") }
// BackupAskKey is the key of the ask about a module's failed backup on a node before it applies a fingerprint:
// `backup.<node>.<module>.<hex>`.
func BackupAskKey(node, module, fingerprint string) (string, error) {
part, err := meshcatalogclient.KeyPart(fingerprint)
part, err := catalogkey.KeyPart(fingerprint)
if err != nil {
return "", err
}
@@ -103,6 +122,16 @@ func BackupAskKey(node, module, fingerprint string) (string, error) {
return AskKindBackup + "." + key, nil
}
// RevertAskKey is the key of the ask about a held revert of a module on a node to the reverted build's fingerprint:
// `revert.<node>.<module>.<hex>` (design 47 G §710).
func RevertAskKey(node, module, fingerprint string) (string, error) {
key, err := BackupAskKey(node, module, fingerprint)
if err != nil {
return "", err
}
return AskKindRevert + strings.TrimPrefix(key, AskKindBackup), nil
}
// AssignmentsAskKey is the key of the authorising ask about a proposal of assignments: `assignments.<proposal id>` (ADR 0567 §5).
func AssignmentsAskKey(proposal string) (string, error) {
if err := meshmoduleassignerclient.CheckProposalID(proposal); err != nil {
@@ -124,7 +153,7 @@ func RecordAskKey(node, module, composed string) (string, error) {
return AskKindRecord + "." + have + "." + strings.TrimPrefix(composed, "sha256:"), nil
}
// ParseAnyAskKey reads an ask key of any kind (a merge, hold, restore, backup, record or assignments ask); it refuses an unknown
// ParseAnyAskKey reads an ask key of any kind (a merge, hold, restore, backup, record, assignments, outside or revert ask); it refuses an unknown
// kind and a key whose parts do not fit its kind, naming the key.
func ParseAnyAskKey(key string) (AskKey, error) {
kind, rest, _ := strings.Cut(key, ".")
@@ -157,12 +186,19 @@ func ParseAnyAskKey(key string) (AskKey, error) {
return refused(err)
}
return AskKey{Kind: kind, Node: node, Module: module, FP: fp}, nil
case AskKindBackup:
case AskKindOutside:
k, err := ParseAnyAskKey(AskKindRestore + "." + rest)
if err != nil {
return refused(fmt.Errorf("an outside ask is outside.<node>.<module>.<fingerprint hex>"))
}
k.Kind = kind
return k, nil
case AskKindBackup, AskKindRevert:
node, module, part, isNode, err := nodeengineclient.ParseComposedKey(rest)
if err != nil || isNode {
return refused(fmt.Errorf("a backup ask is backup.<node>.<module>.<fingerprint hex>"))
return refused(fmt.Errorf("a %s ask is %s.<node>.<module>.<fingerprint hex>", kind, kind))
}
fp, err := meshcatalogclient.ParseKeyPart(part)
fp, err := catalogkey.ParseKeyPart(part)
if err != nil {
return refused(err)
}
@@ -19,6 +19,7 @@ func TestTheAssignersAskKeysKeepTheirFormsAndTheValueItsRules(t *testing.T) {
backup, _ := BackupAskKey("n1", "novox.be", fp)
assignments, _ := AssignmentsAskKey("p-20261028t183000-1a2b3c")
record, _ := RecordAskKey("n1", "gitea", digest)
revert, _ := RevertAskKey("n1", "nats", fp)
for key, want := range map[string]struct {
got string
back AskKey
@@ -28,6 +29,7 @@ func TestTheAssignersAskKeysKeepTheirFormsAndTheValueItsRules(t *testing.T) {
"backup": {backup, AskKey{Kind: "backup", Node: "n1", Module: "novox.be", FP: fp}},
"assignments": {assignments, AskKey{Kind: "assignments", Proposal: "p-20261028t183000-1a2b3c"}},
"record": {record, AskKey{Kind: "record", Node: "n1", Module: "gitea", Composed: digest}},
"revert": {revert, AskKey{Kind: "revert", Node: "n1", Module: "nats", FP: fp}},
} {
back, err := ParseAnyAskKey(want.got)
if err != nil || back != want.back {
@@ -35,7 +37,7 @@ func TestTheAssignersAskKeysKeepTheirFormsAndTheValueItsRules(t *testing.T) {
}
}
for got, want := range map[string]string{hold: "hold.gitea." + hex, restore: "restore.n1.gitea." + hex, backup: "backup.n1.novox=2ebe." + hex,
assignments: "assignments.p-20261028t183000-1a2b3c", record: "record.n1.gitea." + strings.Repeat("cd", 32)} {
assignments: "assignments.p-20261028t183000-1a2b3c", record: "record.n1.gitea." + strings.Repeat("cd", 32), revert: "revert.n1.nats." + hex} {
if got != want {
t.Errorf("key %q, want %q", got, want)
}
@@ -45,7 +47,7 @@ func TestTheAssignersAskKeysKeepTheirFormsAndTheValueItsRules(t *testing.T) {
t.Errorf("a merge ask key: %+v, %v", merge, err)
}
for _, bad := range []string{"", "other.x", "hold.gitea", "hold.gitea.src2:" + hex, "restore.n1", "backup.n1.node", "backup.n1.gitea." + hex[:60],
"assignment.AB", "record.n1.gitea." + hex[:10], "record.n1.node." + hex, "merge.g"} {
"assignment.AB", "record.n1.gitea." + hex[:10], "record.n1.node." + hex, "merge.g", "revert.n1.node", "revert.n1.nats." + hex[:60]} {
if _, err := ParseAnyAskKey(bad); err == nil {
t.Errorf("ParseAnyAskKey(%q) reads a wrong key", bad)
}
@@ -53,8 +55,10 @@ func TestTheAssignersAskKeysKeepTheirFormsAndTheValueItsRules(t *testing.T) {
if proof, err := AskNeedsProof("merge"); err != nil || !proof {
t.Error("a merge ask needs proof")
}
if proof, err := AskNeedsProof("hold"); err != nil || proof {
t.Error("a hold ask needs no proof")
for _, kind := range []string{"hold", "revert"} {
if proof, err := AskNeedsProof(kind); err != nil || proof {
t.Errorf("a %s ask needs no proof", kind)
}
}
if _, err := AskNeedsProof("view"); err == nil {
t.Error("an unknown kind of ask is taken")
+8 -8
View File
@@ -5,19 +5,19 @@ go 1.26.0
require (
git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/contracts/go/clients/meshcatalogclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/contracts/go/clients/meshdeliveryclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshdeliveryclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/sdk v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-sdk/go v0.0.0-00010101000000-000000000000
)
require (
git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner v0.0.0-00010101000000-000000000000 // indirect
git.novox.be/novox/mesh-contracts/go/seats/nodeengine v0.0.0-00010101000000-000000000000 // indirect
git.novox.be/novox/mesh-delivery/contracts/go/clients/containerimageregistryclient v0.0.0-00010101000000-000000000000 // indirect
git.novox.be/novox/mesh-delivery/contracts/go/seats/containerimageregistry v0.0.0-00010101000000-000000000000 // indirect
git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog v0.0.0-00010101000000-000000000000 // indirect
git.novox.be/novox/mesh-delivery/contracts/go/seats/meshdelivery v0.0.0-00010101000000-000000000000 // indirect
git.novox.be/novox/mesh-delivery/contracts/go/seats/ociartifactregistry v0.0.0-00010101000000-000000000000 // indirect
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/containerimageregistryclient v0.0.0-00010101000000-000000000000 // indirect
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/containerimageregistry v0.0.0-00010101000000-000000000000 // indirect
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog v0.0.0-00010101000000-000000000000 // indirect
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshdelivery v0.0.0-00010101000000-000000000000 // indirect
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/ociartifactregistry v0.0.0-00010101000000-000000000000 // indirect
)
@@ -0,0 +1,237 @@
package main
import (
"context"
"maps"
"slices"
"strings"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshwantsclient"
seat "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"mesh-delivery-assigner/internal/acting"
"mesh-delivery-assigner/internal/assign"
"mesh-delivery-assigner/internal/assigngraph"
"mesh-delivery-assigner/internal/assignment"
"mesh-delivery-assigner/internal/buckets"
)
// The waits for an acting part's new version in the steps the assigner holds (design 47 G §266, §268, §276): an entry of the assignment
// graph whose acting edge names composing or placing waits, its want held, until the part's version runs on the edge's node. The wait is
// kept in the state `waits` under `acting.<node>.<module>.<part>`, said as `wait-held` when it starts and `wait-ended` (ran, released,
// replaced) when it ends; `assigner_waits` reads it and `assigner_release` with how `now` lets the entry move with the part's running
// version. A node away starts no wait: its clock starts when the node is present (§268).
// actingOf is the Module.Acting of module: the held acting edges of its entry on a node, those whose wait was not released left out.
func (p *passer) actingOf(module string, released map[string]bool) func(node string) []assign.ActingEdge {
return func(node string) []assign.ActingEdge {
var out []assign.ActingEdge
if p.engineOn(node) == module {
return nil // the node-engine's own want is held by no acting edge, so it is written first (§268, A-323, A-330)
}
for _, e := range p.entryEdges(node, module) {
if acting.Held(e.Step) && !released[acting.Key(node, module, e.Module)+"@"+e.Fp] {
out = append(out, assign.ActingEdge{Node: e.Node, Part: e.Module, Fp: e.Fp, Step: e.Step, Seat: e.Seat})
}
}
return out
}
}
// engineOn is the module that holds the seat node-engine on node in the revision the pass computed, read from the acting edges'
// seat (A-330); "" when none is read.
func (p *passer) engineOn(node string) string {
if p.graph == nil {
return ""
}
return assigngraph.Engines(slices.Collect(maps.Values(p.graph.computed.Entries)))[node]
}
// entryEdges are the acting edges of the entry of module on node in the revision the pass computed.
func (p *passer) entryEdges(node, module string) []seat.Edge {
g := p.graph
if g == nil {
return nil
}
for _, ref := range g.computed.Revision.Entries {
if ref.Node == node && ref.Module == module {
var out []seat.Edge
for _, e := range g.computed.Entries[ref.Digest].Edges {
if e.Kind == "acting" {
out = append(out, e)
}
}
return out
}
}
return nil
}
// actingReleased is the waits released by hand and not yet run, by `<key>@<part's fingerprint>`.
func (p *passer) actingReleased() map[string]bool {
out := map[string]bool{}
for key, raw := range p.w.read(buckets.Waits()) {
if w, err := acting.Decode(raw); err == nil && w.Released && (acting.Is(key) || acting.IsOrder(key)) {
out[key+"@"+w.Fp] = true
}
}
return out
}
// actingWaits keeps the acting waits after the pass's wants: it starts the wait of each entry held for a part's version, ends the
// wait of one that ran, was replaced or was released, and says each.
func (p *passer) actingWaits(ctx context.Context, n assign.Nodes, wanted map[string]map[string]meshwants.Want) {
g := p.graph
if g == nil || p.kvs[buckets.Waits()] == nil {
return
}
now := p.clock()
kept := p.w.read(buckets.Waits())
standing := map[string]bool{}
engines := assigngraph.Engines(slices.Collect(maps.Values(g.computed.Entries)))
held := map[string]bool{} // `<node>/<module>` of each entry held for a part's version
for _, ref := range g.computed.Revision.Entries {
entry := g.computed.Entries[ref.Digest]
if w, ok := wanted[ref.Module][ref.Node]; ok && w.Fp == entry.Fp {
continue // the entry's version is wanted already: nothing moves, so nothing waits
}
if engines[ref.Node] == ref.Module {
continue // the node-engine's own want waits for no acting part (§268, A-323, A-330)
}
for _, e := range entry.Edges {
if e.Kind != "acting" || !acting.Held(e.Step) {
continue
}
key := acting.Key(ref.Node, ref.Module, e.Module)
if took, runs := n.ActingRuns(assign.ActingEdge{Node: e.Node, Part: e.Module, Fp: e.Fp, Step: e.Step, Seat: e.Seat}); runs {
if took != e.Fp && kept[key] != nil {
p.logf("the wait of %s on %s for %s ends: %s runs %s, which serves the seat %s, though its newest is %s (design 47 G A-426)", ref.Module, ref.Node, e.Module, e.Node, took, e.Seat, e.Fp)
}
continue
}
standing[key] = true
held[ref.Node+"/"+ref.Module] = true
if raw := kept[key]; raw != nil {
if w, err := acting.Decode(raw); err == nil && w.Entry == entry.Fp && w.Fp == e.Fp {
p.actingReleaseSaid(ctx, key, w)
continue
}
}
if !n.Online[ref.Node] {
continue // a node away holds only itself, and its clock has not started (§268)
}
w := acting.Wait{Step: e.Step, Node: ref.Node, Module: ref.Module, Part: e.Module, PartNode: e.Node, Fp: e.Fp, Entry: entry.Fp,
Since: now, ClockFrom: now, Bound: acting.BoundOf(e).String()}
if err := p.wantsSay(seat.EventWaitHeld, acting.Body(w, assignment.Module()), key+"."+e.Fp+"."+entry.Fp); err != nil {
p.logf("the wait of %s on %s for %s is not said, and is said at the next pass: %v", ref.Module, ref.Node, e.Module, err)
continue
}
p.put(ctx, buckets.Waits(), key, func() ([]byte, error) { return acting.Encode(w) })
p.logf("the want of %s on %s is held: its acting part %s (step %s) does not run the version %s on %s; the wait %s ends when it does, or by assigner_release", ref.Module, ref.Node, e.Module, e.Step, e.Fp, e.Node, key)
}
}
p.actingCycles(g.computed.Entries, engines, held, n)
for key, raw := range kept {
if !acting.Is(key) || standing[key] {
continue
}
w, err := acting.Decode(raw)
if err != nil {
continue
}
how := acting.HowRan
if w.Released {
how = acting.HowReleased
} else if e, ok := p.edgeOf(w); !ok {
how = acting.HowReplaced
} else if _, runs := n.ActingRuns(e); !runs {
how = acting.HowReplaced
}
if !w.EndSaid {
body := acting.Body(w, assignment.Module())
body.How = how
if err := p.wantsSay(seat.EventWaitEnded, body, key+"."+w.Fp+"."+w.Entry+"."+how); err != nil {
p.logf("the end of the wait of %s on %s for %s is not said, and is said at the next pass: %v", w.Module, w.Node, w.Part, err)
continue
}
}
p.remove(ctx, buckets.Waits(), key)
}
}
// actingReleaseSaid says wait-ended of a wait released by hand, once, and keeps its record so the entry is not held again.
func (p *passer) actingReleaseSaid(ctx context.Context, key string, w acting.Wait) {
if !w.Released || w.EndSaid {
return
}
body := acting.Body(w, assignment.Module())
body.How = acting.HowReleased
body.By = w.By
if err := p.wantsSay(seat.EventWaitEnded, body, key+"."+w.Fp+"."+w.Entry+"."+acting.HowReleased); err != nil {
p.logf("the release of the wait of %s on %s for %s is not said, and is said at the next pass: %v", w.Module, w.Node, w.Part, err)
return
}
w.EndSaid = true
p.put(ctx, buckets.Waits(), key, func() ([]byte, error) { return acting.Encode(w) })
}
// edgeOf is the edge a kept wait stands on, as an acting edge.
func (p *passer) edgeOf(w acting.Wait) (assign.ActingEdge, bool) {
return assign.ActingEdge{Node: w.PartNode, Part: w.Part, Fp: w.Fp, Step: w.Step}, true
}
// actingCycles writes the finding acting-cycle of each held want whose holding edges lie on a cycle no rule breaks, and clears it of
// every other want, a finding a pass before or another process wrote included (design 47 G A-323, A-330). An edge holds while its
// step is the assigner's, its part's version does not run and its wait was not released; the node-engine's own want is held by none.
func (p *passer) actingCycles(entries map[string]seat.AssignmentEntry, engines map[string]string, held map[string]bool, n assign.Nodes) {
if p.findings.Put == nil {
return
}
released := p.actingReleased()
cycles := assigngraph.HeldCycles(slices.Collect(maps.Values(entries)), func(e seat.AssignmentEntry, edge seat.Edge) bool {
return held[e.Node+"/"+e.Module] && engines[e.Node] != e.Module && edge.Kind == "acting" && acting.Held(edge.Step) &&
!released[acting.Key(e.Node, e.Module, edge.Module)+"@"+edge.Fp] && !actingRunsOf(n, edge)
})
raised := map[string]bool{}
for _, at := range slices.Sorted(maps.Keys(cycles)) {
node, module, _ := strings.Cut(at, "/")
o := assign.ActingCycleFinding(node, module, cycles[at])
key := mcseatKey(o)
raised[key] = true
if p.said[key+"="+o.Summary] {
continue // written already as it stands
}
if err := p.findings.Put(o.Finding(p.clock())); err != nil {
p.logf("the finding %s is not written: %v", key, err)
continue
}
p.said[key+"="+o.Summary] = true
}
if p.findings.Keys == nil || p.findings.Delete == nil {
return
}
keys, err := p.findings.Keys()
if err != nil {
p.logf("the findings %s are not read, so none is cleared this pass: %v", assign.KindActingCycle, err)
return
}
for _, key := range keys {
if strings.HasSuffix(key, "."+assign.KindActingCycle) && !raised[key] {
if err := p.findings.Delete(key); err != nil {
p.logf("the finding %s is not cleared: %v", key, err)
continue
}
for said := range p.said {
if strings.HasPrefix(said, key+"=") {
delete(p.said, said)
}
}
}
}
}
// actingRunsOf says whether an assignment edge's acting part runs a build serving it (A-426).
func actingRunsOf(n assign.Nodes, edge seat.Edge) bool {
_, runs := n.ActingRuns(assign.ActingEdge{Node: edge.Node, Part: edge.Module, Fp: edge.Fp, Step: edge.Step, Seat: edge.Seat})
return runs
}
@@ -0,0 +1,186 @@
package main
import (
"context"
"encoding/json"
"strings"
"testing"
"time"
"git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
mcseat "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions"
mwc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshwantsclient"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"mesh-delivery-assigner/internal/acting"
"mesh-delivery-assigner/internal/assign"
"mesh-delivery-assigner/internal/buckets"
)
// Design 47 G §266, §268, §276 (AS9): an entry with an acting edge in composing waits for the part's version to run on the edge's node;
// the wait is kept, said as wait-held with its bound and clock-from, read by assigner_waits, released by assigner_release with how
// `now` and ended when the version runs.
func TestAnEntryWaitsForItsActingPartAndTheWaitIsKeptSaidAndEnded(t *testing.T) {
now := time.Date(2026, 11, 12, 9, 0, 0, 0, time.UTC)
p := newPasser(kvSet{buckets.Waits(): &memKV{values: map[string][]byte{}}}, now)
var events []string
var bodies []meshwants.Wait
p.publishWants = func(event string, body any, id string) error {
events = append(events, event)
bodies = append(bodies, body.(meshwants.Wait))
return nil
}
entry := meshwants.AssignmentEntry{Node: "ace", Module: "nats", Fp: fpTest, Edges: []meshwants.Edge{
{Kind: "acting", Node: "ace", Module: "mesh-host", Fp: "src2:new", Seat: "node-engine", Step: "compose", Bound: "15m"},
{Kind: "acting", Node: "ace", Module: "indexer", Fp: "src2:idx", Seat: "mesh-catalog", Step: "take-in"}}}
p.graph = &graphKeeper{}
p.graph.computed.Revision.Entries = []meshwants.NodeEntryRef{{Node: "ace", Module: "nats", Digest: "d1"}}
p.graph.computed.Entries = map[string]meshwants.AssignmentEntry{"d1": entry}
// The old build of mesh-host serves no seat of the edge here, so the entry waits (A-426: one serving it ends the wait).
notServing := func(nodeengine.Running, string) (bool, bool) { return false, true }
n := assign.Nodes{Online: map[string]bool{"ace": true}, Running: map[string]map[string]nodeengine.Running{"ace": {"mesh-host": {Fingerprint: "src2:old"}}}, Serves: notServing}
wanted := map[string]map[string]mwc.Want{"nats": {"ace": {Fp: "src2:older"}}}
ctx := context.Background()
if got := p.actingOf("nats", nil)("ace"); len(got) != 1 || got[0].Part != "mesh-host" {
t.Fatalf("the assigner holds composing only: %+v", got)
}
p.actingWaits(ctx, n, wanted)
p.actingWaits(ctx, n, wanted) // said once
if len(events) != 1 || events[0] != meshwants.EventWaitHeld {
t.Fatalf("events %v", events)
}
b := bodies[0]
if b.Step != "compose" || b.Part != "mesh-host" || b.Fp != "src2:new" || b.Bound != "15m0s" || b.ClockFrom == nil || !b.ClockFrom.Equal(now) || b.Owner == "" {
t.Errorf("wait-held %+v", b)
}
key := acting.Key("ace", "nats", "mesh-host")
if _, err := acting.Decode(p.w.read(buckets.Waits())[key]); err != nil {
t.Fatalf("the wait is kept: %v", err)
}
// a release by hand lets the entry move, and ends the wait once
w, _ := acting.Decode(p.w.read(buckets.Waits())[key])
w.Released = true
raw, _ := acting.Encode(w)
p.w.put(buckets.Waits(), key, raw)
if got := p.actingOf("nats", p.actingReleased())("ace"); len(got) != 0 {
t.Errorf("a released wait still holds: %+v", got)
}
p.actingWaits(ctx, n, wanted)
p.actingWaits(ctx, n, wanted)
if len(events) != 2 || events[1] != meshwants.EventWaitEnded || bodies[1].How != acting.HowReleased {
t.Fatalf("events %v bodies %+v", events, bodies)
}
// the version runs: the record goes, said nothing more
n.Running["ace"]["mesh-host"] = nodeengine.Running{Fingerprint: "src2:new"}
p.actingWaits(ctx, n, wanted)
if len(p.w.read(buckets.Waits())) != 0 || len(events) != 2 {
t.Errorf("kept %v events %v", p.w.read(buckets.Waits()), events)
}
}
func TestAnActingWaitOfANodeAwayStartsNoClockAndAnEntryWantedAlreadyWaitsNot(t *testing.T) {
p := newPasser(kvSet{buckets.Waits(): &memKV{values: map[string][]byte{}}}, time.Now())
p.publishWants = func(string, any, string) error { t.Fatal("said"); return nil }
p.graph = &graphKeeper{}
p.graph.computed.Revision.Entries = []meshwants.NodeEntryRef{{Node: "ace", Module: "nats", Digest: "d1"}}
p.graph.computed.Entries = map[string]meshwants.AssignmentEntry{"d1": {Node: "ace", Module: "nats", Fp: "src2:a", Edges: []meshwants.Edge{
{Kind: "acting", Node: "ace", Module: "mesh-host", Fp: "src2:new", Step: "compose"}}}}
n := assign.Nodes{Online: map[string]bool{}}
p.actingWaits(context.Background(), n, map[string]map[string]mwc.Want{})
n.Online["ace"] = true
p.actingWaits(context.Background(), n, map[string]map[string]mwc.Want{"nats": {"ace": {Fp: "src2:a"}}})
if len(p.w.read(buckets.Waits())) != 0 || strings.Contains(p.graph.computed.Entries["d1"].Fp, "x") {
t.Errorf("kept %v", p.w.read(buckets.Waits()))
}
}
func TestTheToolsReadAndReleaseAnActingWait(t *testing.T) {
var acts []string
s := newPutTools(memStore{waitsState: &memKV{values: map[string][]byte{}}, buckets.DeliveryWaitsState: &memKV{values: map[string][]byte{}}, buckets.DeliveredAgainState: &memKV{values: map[string][]byte{}}}, func(key string, body any) (json.RawMessage, error) {
acts = append(acts, key)
return json.RawMessage(`{"ok":true,"log":"logged"}`), nil
})
w := acting.Wait{Step: "compose", Node: "ace", Module: "nats", Part: "mesh-host", PartNode: "ace", Fp: "src2:new", Entry: "src2:a", Since: time.Now(), ClockFrom: time.Now(), Bound: "30m0s"}
raw, _ := acting.Encode(w)
s.st.put(waitsState, acting.Key("ace", "nats", "mesh-host"), raw)
got, err := s.doWaits(map[string]any{"module": "nats"})
if list := got.(map[string]any)["waits"].([]any); err != nil || len(list) != 1 || list[0].(actingSaid).BoundEnds == "" {
t.Fatalf("assigner_waits = %+v %v", got, err)
}
if _, err := s.doRelease(map[string]any{"node": "ace", "module": "nats", "how": "now"}, "x"); err == nil {
t.Error("a release with no why is taken")
}
if _, err := s.doRelease(map[string]any{"node": "ace", "module": "nats", "how": "now", "why": "the new engine is known good"}, "shanks.node-tools"); err != nil || len(acts) == 0 {
t.Fatalf("%v %v", err, acts)
}
raw, _, _, _ = s.st.get(waitsState, acting.Key("ace", "nats", "mesh-host"))
if r, _ := acting.Decode(raw); !r.Released || !strings.Contains(r.By, "known good") {
t.Errorf("wait = %+v", r)
}
}
// Design 47 G §268, A-323, A-330: the assigner and the node-engine on a node are one step: the node-engine's own want waits for no
// acting part, so it moves first, and the node's other wants, the assigner's own included, wait for the new node-engine; a want held
// on a cycle no rule breaks is the finding acting-cycle (scope module, id <node>.<module>) naming each edge's step, cleared by the
// next pass that finds it on none.
func TestTheNodeEngineIsWantedFirstAndAWantHeldOnACycleIsAFinding(t *testing.T) {
p := newPasser(kvSet{buckets.Waits(): &memKV{values: map[string][]byte{}}}, time.Date(2026, 11, 13, 2, 0, 0, 0, time.UTC))
p.publishWants = func(string, any, string) error { return nil }
findings := map[string]mcseat.Finding{}
p.findings = assign.Findings{
Put: func(f mcseat.Finding) error { findings[f.Scope+"."+f.ID+"."+f.Kind] = f; return nil },
Delete: func(key string) error { delete(findings, key); return nil },
Keys: func() ([]string, error) {
var keys []string
for k := range findings {
keys = append(keys, k)
}
return keys, nil
}}
compose := meshwants.Edge{Kind: "acting", Node: "ace", Module: "mesh-host", Fp: "src2:engine", Seat: "node-engine", Step: "compose"}
place := meshwants.Edge{Kind: "acting", Node: "ace", Module: "assigner", Fp: "src2:assigner", Seat: "mesh-wants", Step: "place"}
entries := map[string]meshwants.AssignmentEntry{
"d1": {Node: "ace", Module: "mesh-host", Fp: "src2:engine", Edges: []meshwants.Edge{place}},
"d2": {Node: "ace", Module: "assigner", Fp: "src2:assigner", Edges: []meshwants.Edge{compose}},
"d3": {Node: "ace", Module: "app", Fp: "src2:app", Edges: []meshwants.Edge{compose, place}},
}
p.graph = &graphKeeper{}
for d, e := range entries {
p.graph.computed.Revision.Entries = append(p.graph.computed.Revision.Entries, meshwants.NodeEntryRef{Node: e.Node, Module: e.Module, Digest: d})
}
p.graph.computed.Entries = entries
n := assign.Nodes{Online: map[string]bool{"ace": true}, Running: map[string]map[string]nodeengine.Running{"ace": {
"mesh-host": {Fingerprint: "src2:old"}, "assigner": {Fingerprint: "src2:old"}}}, Serves: func(nodeengine.Running, string) (bool, bool) { return false, true }}
wanted := map[string]map[string]mwc.Want{}
if got := p.actingOf("mesh-host", nil)("ace"); len(got) != 0 {
t.Errorf("the node-engine's want is held by %+v, want by no acting edge", got)
}
if got := p.actingOf("assigner", nil)("ace"); len(got) != 1 || got[0].Part != "mesh-host" {
t.Errorf("the assigner's own want is held by %+v, want by the new node-engine", got)
}
p.actingWaits(context.Background(), n, wanted)
kept := p.w.read(buckets.Waits())
if kept[acting.Key("ace", "mesh-host", "assigner")] != nil || kept[acting.Key("ace", "assigner", "mesh-host")] == nil || kept[acting.Key("ace", "app", "mesh-host")] == nil {
t.Errorf("the waits kept: %v", kept)
}
if len(findings) != 0 {
t.Errorf("the cycle the node-engine's want breaks is a finding: %v", findings)
}
// Two parts holding each other across compose and place, neither the node-engine: no rule breaks it.
entries["d4"] = meshwants.AssignmentEntry{Node: "ace", Module: "x", Fp: "src2:x", Edges: []meshwants.Edge{{Kind: "acting", Node: "ace", Module: "y", Fp: "src2:y", Seat: "s-y", Step: "place"}}}
entries["d5"] = meshwants.AssignmentEntry{Node: "ace", Module: "y", Fp: "src2:y", Edges: []meshwants.Edge{{Kind: "acting", Node: "ace", Module: "x", Fp: "src2:x", Seat: "s-x", Step: "compose"}}}
p.graph.computed.Revision.Entries = append(p.graph.computed.Revision.Entries, meshwants.NodeEntryRef{Node: "ace", Module: "x", Digest: "d4"},
meshwants.NodeEntryRef{Node: "ace", Module: "y", Digest: "d5"})
p.actingWaits(context.Background(), n, wanted)
f, ok := findings["module.ace.x.acting-cycle"]
if len(findings) != 2 || !ok || !strings.Contains(f.Summary, "ace/x -[place]-> ace/y -[compose]-> ace/x") {
t.Fatalf("the findings of a cycle no rule breaks: %v", findings)
}
// x's new version runs: y no longer waits, so neither is held on a cycle, and both findings clear.
n.Running["ace"]["x"] = nodeengine.Running{Fingerprint: "src2:x"}
p.actingWaits(context.Background(), n, wanted)
if len(findings) != 0 {
t.Errorf("the findings after the cycle broke: %v", findings)
}
}
@@ -0,0 +1,100 @@
package main
import (
"encoding/json"
"errors"
"fmt"
"strings"
"time"
occ "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/clients/operatorchannelclient"
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-assigner/asks"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshdeliveryclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-teller/tellerevents"
stdio "git.novox.be/novox/mesh-sdk/go"
"mesh-delivery-assigner/internal/assign"
"mesh-delivery-assigner/internal/buckets"
"mesh-delivery-assigner/internal/puts"
)
// askAgainTool asks one of the assigner's asks again by hand (issue 1966, ADR 0668 §5): the recovery of an ask that ended at
// the operator channel without an answer when the event that would have asked it again was not heard.
const askAgainTool = "assigner_ask_again"
// asksState and answersState are the assigner's asks and the teller's answers, as the runtime names them.
const (
asksState = "asks"
answersState = buckets.TellerModule + ".answers"
)
// askAgainByHand writes the ask at key again under a new asking, by the rules the teller's ask-ended writes it by (assign.AskedAgain:
// a proposal's authorising ask and a put's record ask are not), so the teller asks it again; an asking the operator answered
// is refused, naming the answer. The act is recorded through the seat mesh-hand-acts.
func askAgainByHand(st store, ask func(string, any) (json.RawMessage, error), key, why, by string, now time.Time) (any, error) {
switch {
case key == "":
return nil, errors.New("name the ask's key, as the tool asks lists it")
case why == "":
return nil, errors.New("a hand ask again says why")
case by == "" || by == stdio.Unproven:
return nil, errors.New("a hand ask again names who asks it, and the runtime proved no caller")
}
current, _, found, err := st.get(asksState, key)
if err != nil {
return nil, err
}
if !found {
return nil, fmt.Errorf("the assigner holds no ask under %s: the tool asks lists them", key)
}
_, routerAsk, err := assign.DecodeAsk(key, current)
if err != nil {
return nil, err
}
if raw, _, found, err := st.get(answersState, key); err == nil && found {
if a, err := meshdeliveryclient.DecodeAnswer(raw); err == nil && strings.HasPrefix(a.Warrant, routerAsk.ID+"@") {
return nil, fmt.Errorf("the asking %s was answered %q (%s): it is not asked again", routerAsk.ID, a.Option, a.Words)
}
}
var put *puts.Put
if k, err := asks.ParseAnyAskKey(key); err == nil && k.Kind == asks.AskKindRecord {
if pkey, err := puts.Key(k.Node, k.Module); err == nil {
if raw, _, found, err := st.get(putsState, pkey); err == nil && found {
if p, err := puts.Decode(raw); err == nil {
put = &p
}
}
}
}
value, refused := assign.AskedAgain(tellerevents.Ended{Key: key, Ask: routerAsk.ID, Outcome: occ.OutcomeCancelled}, current, put, now)
if refused != "" {
return nil, errors.New(refused)
}
if err := st.put(asksState, key, value); err != nil {
return nil, fmt.Errorf("the ask %s is not written again: %w", key, err)
}
_, next, _ := assign.DecodeAsk(key, value)
taken, rerr := meshhandactsclient.Recorder{Ask: ask}.Record(meshhandactsclient.Request{What: askAgainTool + " " + key, Why: why + " (" + by + ")", Cause: "ask-again"})
recorded := taken.Log
if rerr != nil {
recorded = "not recorded: " + rerr.Error()
}
return map[string]any{"key": key, "ended": routerAsk.ID, "asked": next.ID, "by": by, "hand-act": recorded}, nil
}
// askAgainTools is the tool over the runtime's states.
func askAgainTools(st store, ask func(string, any) (json.RawMessage, error), now func() time.Time) []stdio.Tool {
return []stdio.Tool{{Name: askAgainTool, Description: "Ask one of the assigner's asks of the operator again (issue 1966): the ask " +
"under key is written again under a new asking, which the teller asks on the operator channel, as when the channel says it " +
"ended without an answer. Refused for an asking the operator answered, a proposal's authorising ask (the seat's verb again " +
"asks it) and a record ask a put asked. Recorded as a hand act.",
Input: schema(map[string]string{"key": "the ask's key, as the tool asks lists it", "why": "why it is asked again"},
[]string{"key", "why"}),
Run: func(a map[string]any) (any, error) {
key, _ := a["key"].(string)
why, _ := a["why"].(string)
return askAgainByHand(st, ask, key, why, stdio.CallerOf(a), now())
}}}
}
@@ -0,0 +1,239 @@
package main
import (
"context"
"encoding/json"
"errors"
"time"
"github.com/nats-io/nats.go/jetstream"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-assigner/asks"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-teller/tellerevents"
"git.novox.be/novox/mesh-sdk/go/busretry"
"git.novox.be/novox/mesh-sdk/go/process"
mcc "git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient"
oc "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/seats/operatorchannel"
"mesh-delivery-assigner/internal/assign"
"mesh-delivery-assigner/internal/buckets"
"mesh-delivery-assigner/internal/puts"
)
// askEndedSubject is the teller's event ask-ended, as the manifest's consumes names it (`mesh-delivery-teller.ask-ended`).
var askEndedSubject = process.Account{Module: buckets.TellerModule}.EventSubject(tellerevents.AskEnded)
// staleOf says why the ask at a key is stale, as the pass reads it (passer.staleAsk), or "" when it is not or when the
// trunk is not read; nil reads nothing.
type staleOf func(key string) string
// staleOfWorld is staleOf over the world the pass reads: the same rule as the pass, over the same cache.
func staleOfWorld(w *world) staleOf {
p := &passer{w: w}
return func(key string) string {
trunk := w.trunk()
if len(trunk) == 0 {
return ""
}
return p.staleAsk(key, trunk)
}
}
// hearAskEnded hears the teller's ask-ended on the assigner's one hub of its durable consumer on EVENTS (registered before
// the hub starts): an ask of the assigner's that ended at the operator channel without an answer while its key stands is
// written again under a new asking, so the teller asks it again (issue 1966, note 151). asksKV is the assigner's asks; the
// puts are opened at each event, since a put's record ask is not written again (ADR 0546).
func hearAskEnded(ctx context.Context, js jetstream.JetStream, hub *process.EventHub, asksKV jetstream.KeyValue, stale staleOf, logf func(string, ...any)) error {
return hub.Handle(askEndedSubject, func(m jetstream.Msg) {
var putsKV jetstream.KeyValue
if kv, err := js.KeyValue(ctx, buckets.Puts()); err == nil {
putsKV = kv
}
if err := askAgain(ctx, asksKV, putsKV, stale, m.Data(), time.Now(), logf); err != nil {
logf("%s: %v; it is heard again", m.Subject(), err)
_ = m.Nak()
return
}
if err := m.Ack(); err != nil {
logf("acknowledging %s: %v", m.Subject(), err)
}
})
}
// channelAsksVerb is the operator-channel seat's verb asks, read at the assigner's consumer's bind (a seat verb: no module
// named).
const channelAsksVerb = "seat:" + oc.Seat + "." + oc.VerbAsks
// readEndedAtBind registers on the hub, before it starts, one read of the operator-channel seat's asks at each bind of the
// assigner's consumer: an ask-ended the teller said before the consumer existed is not delivered to it (issue 1966 note 155,
// ADR 0668 §4), so each held ask whose asking ended there expired or cancelled is written again as that event writes it
// (askAgain, with every rule and its compare-and-set). The read is a kept call (CallKept), made off the hub's start.
func readEndedAtBind(ctx context.Context, js jetstream.JetStream, hub *process.EventHub, asksKV jetstream.KeyValue, stale staleOf, bus caller, wait callWait, logf func(string, ...any)) {
if asksKV == nil || bus == nil {
return
}
hub.OnBound(func(created time.Time) {
go func() {
if err := endedAtBind(ctx, js, asksKV, stale, bus, wait, created, time.Now(), logf); err != nil {
logf("the operator channel's ended asks are not read at the bind of %s (%v): an ask that ended there before is asked again when the teller says it ended", created.Format(time.RFC3339), err)
}
}()
})
}
// callWait is how a kept call the assigner waits on is said (novox/hq ADR 0668 §3): heard says the callee's machine is
// heard, now is the clock, and findings the assigner's findings, where the call unanswered past
// meshconditionsclient.CallUnansweredAfter is the finding call-unanswered while heard, cleared when it is answered.
type callWait struct {
heard func() bool
now func() time.Time
findings assign.Findings
}
// asksCallID is the finding's id for the bind's read of the operator channel's asks.
const asksCallID = "operator-channel-asks"
// keep makes call again after every transport fault (busretry: a request that reached no one, or one whose deadline
// passed) until it is answered or ctx ends, each try itself a kept call; past the bound with the callee heard it writes
// the finding call-unanswered, and clears it when answered. No timer: each try is the wait.
func (cw callWait) keep(ctx context.Context, id, callee string, call func() (json.RawMessage, error), logf func(string, ...any)) (json.RawMessage, error) {
clock := cw.now
if clock == nil {
clock = time.Now
}
since, said := clock(), false
key := mcc.Key(mcc.ScopeCall, id, mcc.KindCallUnanswered)
for {
answer, err := call()
if err == nil || !(busretry.Undelivered(err) || busretry.TimedOut(err)) || ctx.Err() != nil {
if said && cw.findings.Delete != nil {
if derr := cw.findings.Delete(key); derr != nil {
logf("the finding %s is not cleared: %v", key, derr)
}
}
return answer, err
}
if said || clock().Sub(since) < mcc.CallUnansweredAfter || cw.heard == nil || !cw.heard() || cw.findings.Put == nil {
continue
}
eerr := cw.findings.Put(assign.CallUnanswered(id, callee, "", err.Error(), "assigner."+mcc.KindCallUnanswered, since).Finding(clock()))
if eerr != nil {
logf("the finding %s is not written: %v", key, eerr)
continue
}
said = true
logf("%s is unanswered since %s and its callee's machine is heard: the finding %s", callee, since.UTC().Format(time.RFC3339), key)
}
}
// endedAtBind is readEndedAtBind's one read: the held asks, the seat's verb (a kept call whose wait is kept, wait), and
// each ended asking written again.
func endedAtBind(ctx context.Context, js jetstream.JetStream, asksKV jetstream.KeyValue, stale staleOf, bus caller, wait callWait, created, now time.Time, logf func(string, ...any)) error {
keys, err := asksKV.Keys(ctx)
if errors.Is(err, jetstream.ErrNoKeysFound) {
return nil
}
if err != nil {
return err
}
held := map[string][]byte{}
for _, key := range keys {
if e, err := asksKV.Get(ctx, key); err == nil {
held[key] = e.Value()
}
}
query, ok := assign.ChannelAsksQuery(held)
if !ok {
return nil
}
answer, err := wait.keep(ctx, asksCallID, channelAsksVerb, func() (json.RawMessage, error) { return bus.CallKept(channelAsksVerb, query) }, logf)
if err != nil {
return err
}
ended, cut, err := assign.EndedAtChannel(held, answer)
if err != nil {
return err
}
if cut != "" {
logf("%s at the bind: %s", channelAsksVerb, cut)
}
var putsKV jetstream.KeyValue
if js != nil {
if kv, err := js.KeyValue(ctx, buckets.Puts()); err == nil {
putsKV = kv
}
}
for _, e := range ended {
body, err := tellerevents.EncodeEnded(e)
if err == nil {
err = askAgain(ctx, asksKV, putsKV, stale, body, now, logf)
}
if err != nil {
return err
}
}
logf("%s at the bind of %s: %d of %d held asks ended at the channel without an answer", channelAsksVerb, created.Format(time.RFC3339), len(ended), len(held))
return nil
}
// askAgain writes the ask the teller said ended again under a new asking, by compare-and-set at the revision that holds the
// asking that ended (assign.AskedAgain), and says in the journal what it wrote or why it wrote nothing. Only a bus that
// could not be read or written is an error, so the event is heard again; a body that does not read is said and dropped.
func askAgain(ctx context.Context, asksKV, putsKV jetstream.KeyValue, stale staleOf, data []byte, now time.Time, logf func(string, ...any)) error {
e, err := tellerevents.DecodeEnded(data)
if err != nil {
logf("the teller's %s holds what is not an ended ask, and is dropped: %v", tellerevents.AskEnded, err)
return nil
}
if asksKV == nil {
return errors.New("the assigner's asks are not open")
}
var current []byte
var rev uint64
entry, err := asksKV.Get(ctx, e.Key)
switch {
case errors.Is(err, jetstream.ErrKeyNotFound):
case err != nil:
return err
default:
current, rev = entry.Value(), entry.Revision()
}
var put *puts.Put
if k, err := asks.ParseAnyAskKey(e.Key); err == nil && k.Kind == asks.AskKindRecord && putsKV != nil {
if pkey, err := puts.Key(k.Node, k.Module); err == nil {
pe, err := putsKV.Get(ctx, pkey)
switch {
case errors.Is(err, jetstream.ErrKeyNotFound):
case err != nil:
return err
default:
if p, err := puts.Decode(pe.Value()); err == nil {
put = &p
}
}
}
}
value, why := assign.AskedAgain(e, current, put, now)
if why == "" && stale != nil {
// An ask the pass takes away is not written again: it is about a move or a composition that has been left behind, and the
// pass removes it (issue 1966 note 165).
if s := stale(e.Key); s != "" {
why = "it is stale and left to the pass to take away: " + s
}
}
if why != "" {
logf("%s: the ask %s ended (%s) at the operator channel without an answer, and is not written again: %s", e.Key, e.Ask, e.Outcome, why)
return nil
}
if _, err := asksKV.Update(ctx, e.Key, value, rev); err != nil {
if errors.Is(err, jetstream.ErrKeyExists) {
logf("%s: the ask %s ended (%s) without an answer, and the key changed since: it is not written again", e.Key, e.Ask, e.Outcome)
return nil
}
return err
}
logf("%s: the ask %s ended (%s) at the operator channel without an answer, and is written again under a new asking, which the teller asks", e.Key, e.Ask, e.Outcome)
return nil
}
@@ -0,0 +1,117 @@
package main
import (
"errors"
"io/fs"
"os"
"slices"
"strings"
mmac "git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient"
mma "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
"mesh-delivery-assigner/internal/judge"
)
// Which proposals the assigner asks of the operator is its setting ask-operator-for (design 47 G A-425, A-425a): a list of change
// kinds, set at mesh level with mesh-config's config, its default take-off, remove-node and stops. A proposal none of whose changes
// is listed is applied at once when its verdict passes, said in the log and by assignments-changed; one with a listed kind is
// asked as before. The setting is read from the file the manifest declares with the content ${config:ask-operator-for}, which the
// environment names (A-112), at every pass, and a change of it is said.
// KindStops is the change kind of a verdict whose answers say a node would stop running a module.
const KindStops = "stops"
// defaultAskOperatorFor is the setting's default.
var defaultAskOperatorFor = []string{mmac.OpTakeOff, mmac.OpRemoveNode, KindStops}
// askKinds are the kinds the setting may name.
var askKinds = []string{mmac.OpPlace, mmac.OpTakeOff, mmac.OpPin, mmac.OpUnpin, mmac.OpHold, mmac.OpUnhold, mmac.OpDecide, mmac.OpConfig,
mmac.OpAddNode, mmac.OpRemoveNode, KindStops}
// parseAskOperatorFor reads the setting's value: kinds separated by commas or spaces; empty is the default. A kind it does not
// know is answered apart and named nowhere in the list.
func parseAskOperatorFor(raw string) (kinds, unknown []string) {
fields := strings.FieldsFunc(raw, func(r rune) bool { return r == ',' || r == ' ' || r == '\n' || r == '\t' })
if len(fields) == 0 {
return slices.Clone(defaultAskOperatorFor), nil
}
for _, f := range fields {
f = strings.ToLower(strings.TrimSpace(f))
switch {
case !slices.Contains(askKinds, f):
unknown = append(unknown, f)
case !slices.Contains(kinds, f):
kinds = append(kinds, f)
}
}
slices.Sort(kinds)
return kinds, unknown
}
// readAskOperatorFor reads the setting's file: the default for no path or no file.
func readAskOperatorFor(path string) (kinds, unknown []string, err error) {
if path == "" {
k, u := parseAskOperatorFor("")
return k, u, nil
}
raw, err := os.ReadFile(path)
if errors.Is(err, fs.ErrNotExist) {
k, u := parseAskOperatorFor("")
return k, u, nil
}
if err != nil {
return nil, nil, err
}
k, u := parseAskOperatorFor(string(raw))
return k, u, nil
}
// askOperatorFor is the setting as this pass read it: the file read again each pass, a change said once, a file that cannot be
// read keeping what was read last (the default before any).
func (p *passer) askOperatorFor() []string {
kinds, unknown, err := readAskOperatorFor(p.askForFile)
if err != nil {
if p.askFor == nil {
p.askFor = slices.Clone(defaultAskOperatorFor)
}
p.logf("the setting ask-operator-for cannot be read from %s, so %s stands: %v", p.askForFile, strings.Join(p.askFor, ", "), err)
return p.askFor
}
if !slices.Equal(kinds, p.askFor) {
words := "the setting ask-operator-for is " + strings.Join(kinds, ", ") + ": a proposal with a change of another kind only is applied with no ask"
if len(unknown) > 0 {
words += "; kinds it names that are none are left out: " + strings.Join(unknown, ", ")
}
p.logf("%s", words)
p.askFor = kinds
}
return p.askFor
}
// asksFor says whether a proposal of these change kinds is asked of the operator.
func (p *passer) asksFor(kinds []string) bool {
set := p.askOperatorFor()
for _, k := range kinds {
if slices.Contains(set, k) {
return true
}
}
return false
}
// proposalKinds are the change kinds of a proposal whose verdict is v: each change's op, and stops when an answer says a node
// would stop running a module.
func proposalKinds(prop mma.Proposal, v mma.Verdict) []string {
var out []string
for _, c := range prop.Changes {
if c.Op != "" && !slices.Contains(out, c.Op) {
out = append(out, c.Op)
}
}
if len(judge.Stops(v)) > 0 {
out = append(out, KindStops)
}
slices.Sort(out)
return out
}
@@ -0,0 +1,74 @@
package main
import (
"encoding/json"
"testing"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-assigner/asks"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
)
// Design 47 G §717: the assigner's asks are the seat mesh-wants' state asks, so every key its asks package writes is one of
// that state's key forms, read back to the same parts, and each value is the seat's Ask.
func TestTheAssignersAsksAreTheSeatMeshWantsAsks(t *testing.T) {
const hex = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
const fp, digest = "src2:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
must := func(k string, err error) string {
t.Helper()
if err != nil {
t.Fatal(err)
}
return k
}
three := func(parse func(string) (string, string, string, bool)) func(string) []string {
return func(k string) []string {
if a, b, c, ok := parse(k); ok {
return []string{a, b, c}
}
return nil
}
}
for _, row := range []struct {
key string
parse func(string) []string
want []string
}{
{must(asks.HoldAskKey("web", fp)), func(k string) []string {
if a, b, ok := meshwants.ParseAsksByHoldModuleFingerprintKey(k); ok {
return []string{a, b}
}
return nil
}, []string{"web", hex}},
{must(asks.RestoreAskKey("ace", "web", fp)), three(meshwants.ParseAsksByRestoreNodeModuleFingerprintKey), []string{"ace", "web", hex}},
{must(asks.BackupAskKey("ace", "web", fp)), three(meshwants.ParseAsksByBackupNodeModuleFingerprintKey), []string{"ace", "web", hex}},
{must(asks.OutsideAskKey("ace", "web", fp)), three(meshwants.ParseAsksByOutsideNodeModuleFingerprintKey), []string{"ace", "web", hex}},
{must(asks.RevertAskKey("ace", "web", fp)), three(meshwants.ParseAsksByRevertNodeModuleFingerprintKey), []string{"ace", "web", hex}},
{must(asks.RecordAskKey("ace", "web", digest)), three(meshwants.ParseAsksByRecordNodeModuleDigestKey), []string{"ace", "web", "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"}},
{must(asks.AssignmentsAskKey("p-20261028t183000-1a2b3c")), func(k string) []string {
if a, ok := meshwants.ParseAsksByAssignmentsProposalKey(k); ok {
return []string{a}
}
return nil
}, []string{"p-20261028t183000-1a2b3c"}},
} {
got := row.parse(row.key)
if len(got) != len(row.want) {
t.Errorf("%s is no key form of mesh-wants' asks: read as %v", row.key, got)
continue
}
for i := range got {
if got[i] != row.want[i] {
t.Errorf("%s reads as %v, want %v", row.key, got, row.want)
break
}
}
}
key := must(asks.HoldAskKey("web", fp))
raw, err := asks.EncodeAsk(key, asks.Ask{Ask: json.RawMessage(`{"id":"x"}`), Asking: 2})
if err != nil {
t.Fatal(err)
}
if v, err := meshwants.DecodeAsksByHoldModuleFingerprintValue(raw); err != nil || v.Asking != 2 {
t.Errorf("the ask %s is not the seat's Ask: %+v, %v", raw, v, err)
}
}
@@ -0,0 +1,235 @@
package main
import (
"context"
"encoding/json"
"fmt"
"maps"
"strconv"
"strings"
"sync"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-sdk/go/process"
"github.com/nats-io/nats.go/jetstream"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
"mesh-delivery-assigner/internal/assign"
"mesh-delivery-assigner/internal/assignment"
)
// What a want names of a build is heard, never read from the builder's state (design 47 G §379, §526, A-94, A-96; ADR 0596 §2): the
// builder's event `build.ended` (a done build's parts by digest, its keeping node and its branch) and the catalog's
// `version-released` (a released version and each part's digest, with the source revision it was built from), each kept as heard.
// builtEnds are the done builds' ends heard, by module and fingerprint (hearBuildEnded).
type builtEnds struct {
mu sync.Mutex
ends map[string]builds.BuildEnded
}
func (b *builtEnds) key(module, fp string) string { return module + "@" + fp }
// put takes one build.ended in.
func (b *builtEnds) put(data []byte) error {
var e builds.BuildEnded
if err := json.Unmarshal(data, &e); err != nil {
return fmt.Errorf("a build.ended that is no end: %w", err)
}
if e.Module == "" || e.Fingerprint == "" {
return fmt.Errorf("a build's end naming no module or fingerprint: %s", data)
}
if e.Outcome == "" { // an end said before A-162 is a done build's
e.Outcome = builds.BuildDone
}
b.mu.Lock()
defer b.mu.Unlock()
if b.ends == nil {
b.ends = map[string]builds.BuildEnded{}
}
b.ends[b.key(e.Module, e.Fingerprint)] = e
return nil
}
// endOf is the end heard of module's build at fp, done or failed (A-162): none while the build has not ended.
func (b *builtEnds) endOf(module, fp string) (builds.BuildEnded, bool) {
b.mu.Lock()
defer b.mu.Unlock()
e, ok := b.ends[b.key(module, fp)]
return e, ok
}
// partsOf is the parts of module's build at fp as its end names them (each artifact's digest by `<module>:<artifact>`), with the
// node that keeps it, for a kept build or a build of another watched branch; false for a build of the trunk not kept, whose
// parts the version's release says (releasedVersions).
func (b *builtEnds) partsOf(module, fp string) (assign.KeptBuild, bool) {
b.mu.Lock()
e, ok := b.ends[b.key(module, fp)]
b.mu.Unlock()
if !ok || (e.KeptOn == "" && e.Branch == "") {
return assign.KeptBuild{}, false
}
parts := map[string]string{}
for name, digest := range e.Made {
parts[module+":"+name] = digest
}
return assign.KeptBuild{Parts: parts, KeptOn: e.KeptOn}, true
}
// releasedVersions are the catalog's version-released heard, by module and source revision.
type releasedVersions struct {
mu sync.Mutex
seen map[string]assign.KeptBuild
// newest is, by module, the last version-released heard of it (delivered.go).
newest map[string]releaseHeard
}
func (r *releasedVersions) key(module string, source int64) string {
return fmt.Sprintf("%s@%d", module, source)
}
// put takes one version-released in.
func (r *releasedVersions) put(data []byte) error {
var e meshcatalog.VersionReleasedEvent
if err := json.Unmarshal(data, &e); err != nil {
return fmt.Errorf("a version-released that is none: %w", err)
}
if e.Module == "" || e.Version == "" {
return fmt.Errorf("a version-released naming no module or version: %s", data)
}
parts := map[string]string{}
for _, a := range e.Artifacts {
parts[partRef(e.Module, a.Artifact)] = a.Digest
}
r.mu.Lock()
defer r.mu.Unlock()
if r.seen == nil {
r.seen = map[string]assign.KeptBuild{}
}
r.seen[r.key(e.Module, e.Source)] = assign.KeptBuild{Version: e.Version, Parts: parts}
if r.newest == nil {
r.newest = map[string]releaseHeard{}
}
h := releaseHeard{Version: e.Version, Parts: parts, Source: e.Source}
if e.At != nil {
h.At = *e.At
}
r.newest[e.Module] = h // the stream's order is the order of release
return nil
}
// withParts is the version of module whose release named exactly parts (`<module>:<artifact>` -> digest), the newest such when
// more than one did; false when none did or parts is empty (design 47 G A-421).
func (r *releasedVersions) withParts(module string, parts map[string]string) (assign.KeptBuild, bool) {
if len(parts) == 0 {
return assign.KeptBuild{}, false
}
r.mu.Lock()
defer r.mu.Unlock()
var out assign.KeptBuild
found := false
for key, k := range r.seen {
if m, _, ok := strings.Cut(key, "@"); !ok || m != module || !maps.Equal(k.Parts, parts) {
continue
}
if !found || compareVersion(k.Version, out.Version) > 0 {
out, found = k, true
}
}
return out, found
}
// madeOf is what module's done build at fp made, by `<module>:<artifact>`, as its build.ended names it; none for a build not heard
// or not done (design 47 G A-421).
func (b *builtEnds) madeOf(module, fp string) map[string]string {
e, ok := b.endOf(module, fp)
if !ok || e.Outcome != builds.BuildDone {
return nil
}
parts := map[string]string{}
for name, digest := range e.Made {
parts[module+":"+name] = digest
}
return parts
}
// of is the version of module released from the source revision, with its parts' digests; false before it is heard.
func (r *releasedVersions) of(module string, source int64) (assign.KeptBuild, bool) {
r.mu.Lock()
defer r.mu.Unlock()
k, ok := r.seen[r.key(module, source)]
return k, ok
}
// buildsStreamName is the builder's stream of build ends as the bus names it: kept last per subject (one end per module and
// fingerprint, its manifest's `last-per-subject`, design 47 G A-181, §703).
var buildsStreamName = catalogue.StreamBusName(builds.BuildsStream)
// hearBuilds reads the builder's stream of build ends whole at the start and then follows it (design 47 G A-181, §556): what was
// built, and a failed build's error, survive the assigner's restart, and it reads none of the builder's buckets. The read ends before
// it returns, so the first pass knows every build; a stream it cannot hear is said, and no want names a build until the assigner
// starts again.
func hearBuilds(ctx context.Context, js jetstream.JetStream, ends *builtEnds, wake func(), findings assign.Findings, logf func(string, ...any)) {
acct := process.Account{Node: thisNode, Module: assignment.Module()}
nh := notHeardWriter(findings, logf)
cc, err := acct.HearStream(ctx, js, buildsStreamName, func(m jetstream.Msg) {
if err := ends.put(m.Data()); err != nil {
logf("%s is not kept: %v", m.Subject(), err)
}
if err := m.Ack(); err != nil {
logf("acknowledging %s: %v", m.Subject(), err)
}
wake()
}, logf, process.FromFirst()) // read whole from its first message whether the bus keeps it last per subject or by age (A-181, A-233)
if err != nil {
nh.NotHeard(buildsStreamName, "what the builder built is not heard until the assigner starts again, so no want names a build's parts or its keeping node and no put goes on", err)
return
}
nh.Heard(buildsStreamName)
go func() {
<-ctx.Done()
cc.Stop()
}()
}
// hearTaken registers the hub's taker of the indexer's take-in.taken, each waking the pass (orderwaits.go, §298, A-260); before
// the hub starts.
func hearTaken(hub *process.EventHub, taken *takenSources, wake func(), logf func(string, ...any)) error {
return hub.Handle(takenSubject, func(m jetstream.Msg) {
if err := taken.put(m.Data()); err != nil {
logf("%s is not kept: %v", m.Subject(), err)
}
if err := m.Ack(); err != nil {
logf("acknowledging %s: %v", m.Subject(), err)
}
wake()
})
}
// compareVersion orders two MAJOR.MINOR.PATCH versions by their numbers; a part that is no number counts as 0.
func compareVersion(a, b string) int {
pa, pb := strings.Split(a, "."), strings.Split(b, ".")
for i := 0; i < 3; i++ {
var x, y int
if i < len(pa) {
x, _ = strconv.Atoi(pa[i])
}
if i < len(pb) {
y, _ = strconv.Atoi(pb[i])
}
if x != y {
return x - y
}
}
return 0
}
// partRef is a release's artifact as a part's key, `<module>:<artifact>`: the contract's VersionArtifact names the artifact
// reference whole (an ArtifactRef), as the catalog's version-released says it; a bare name is taken as the module's (A-96).
func partRef(module, artifact string) string {
if strings.Contains(artifact, ":") {
return artifact
}
return module + ":" + artifact
}
@@ -0,0 +1,154 @@
package main
import (
"encoding/json"
"fmt"
"reflect"
"strings"
"testing"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"mesh-delivery-assigner/internal/assign"
)
// Design 47 G §379, §526, A-96: a build.ended heard names a kept build's or another branch's parts by digest (`<module>:<artifact>`) and its
// keeping node; a build of the trunk not kept names none, its parts being the release's.
func TestABuildEndedHeardNamesAKeptBuildsPartsAndItsNode(t *testing.T) {
put := func(b *builtEnds, e builds.BuildEnded) {
raw, _ := json.Marshal(e)
if err := b.put(raw); err != nil {
t.Fatal(err)
}
}
made := map[string]string{"program": "sha256:1"}
var b builtEnds
put(&b, builds.BuildEnded{Module: "node-engine", Fingerprint: "a", Made: made})
if _, ok := b.partsOf("node-engine", "a"); ok {
t.Error("a trunk build not kept names parts")
}
put(&b, builds.BuildEnded{Module: "node-engine", Fingerprint: "b", Made: made, KeptOn: "ace"})
if k, ok := b.partsOf("node-engine", "b"); !ok || k.KeptOn != "ace" || !reflect.DeepEqual(k.Parts, map[string]string{"node-engine:program": "sha256:1"}) {
t.Errorf("kept build = %+v, %v", k, ok)
}
put(&b, builds.BuildEnded{Module: "node-engine", Fingerprint: "c", Made: made, Branch: "cand"})
if k, ok := b.partsOf("node-engine", "c"); !ok || k.KeptOn != "" || len(k.Parts) != 1 {
t.Errorf("branch build = %+v, %v", k, ok)
}
if err := b.put([]byte(`{"module":"x"}`)); err == nil {
t.Error("an end naming no fingerprint is kept")
}
}
// Design 47 G §379, A-96: a version-released heard names the version and the parts' digests of the module's source revision.
func TestAVersionReleasedHeardNamesItsVersionAndPartsBySource(t *testing.T) {
var r releasedVersions
raw, _ := json.Marshal(meshcatalog.VersionReleasedEvent{Module: "mail", Source: 7, Version: "1.2.3", Artifacts: []meshcatalog.VersionArtifact{{Artifact: "image", Digest: "sha256:9"}}})
if err := r.put(raw); err != nil {
t.Fatal(err)
}
want := assign.KeptBuild{Version: "1.2.3", Parts: map[string]string{"mail:image": "sha256:9"}}
if k, ok := r.of("mail", 7); !ok || !reflect.DeepEqual(k, want) {
t.Errorf("released = %+v, %v", k, ok)
}
if _, ok := r.of("mail", 8); ok {
t.Error("another source revision names a version")
}
}
// Design 47 G §379, A-96, A-419: the trunk's entry takes its version and parts from the version-released of the source its
// fingerprint was built at (its fp-src), whatever source the kept assignment graph revision is at; a kept build from its end; no
// revision kept, another fingerprint, an fp-src with no release or none names none, and an unheard release is said once.
func TestATrunkEntryTakesItsVersionFromTheReleaseOfItsFingerprintsSource(t *testing.T) {
w := newWorld()
raw, _ := json.Marshal(meshcatalog.VersionReleasedEvent{Module: "mail", Source: 7, Version: "1.2.3", Artifacts: []meshcatalog.VersionArtifact{{Artifact: "mail:image", Digest: "sha256:9"}}})
if err := w.released.put(raw); err != nil {
t.Fatal(err)
}
endRaw, _ := json.Marshal(builds.BuildEnded{Module: "mail", Fingerprint: "k", Made: map[string]string{"image": "sha256:2"}, KeptOn: "g14"})
if err := w.ends.put(endRaw); err != nil {
t.Fatal(err)
}
var logs []string
p := &passer{w: w, graph: &graphKeeper{ok: true, source: 7}, logf: func(f string, a ...any) { logs = append(logs, fmt.Sprintf(f, a...)) }}
named := p.namedBuild("mail", "t", 7)
if k, ok := named("t"); !ok || k.Version != "1.2.3" || k.Parts["mail:image"] != "sha256:9" || k.KeptOn != "" {
t.Errorf("trunk entry = %+v, %v", k, ok)
}
if k, ok := named("k"); !ok || k.KeptOn != "g14" || k.Version != "" {
t.Errorf("kept build = %+v, %v", k, ok)
}
if _, ok := named("other"); ok {
t.Error("another fingerprint names a release")
}
// A build held back at an older fingerprint names the release whose parts are exactly what it made.
heldRaw, _ := json.Marshal(builds.BuildEnded{Module: "mail", Fingerprint: "old", Made: map[string]string{"image": "sha256:9"}})
if err := w.ends.put(heldRaw); err != nil {
t.Fatal(err)
}
if k, ok := named("old"); !ok || k.Version != "1.2.3" {
t.Errorf("a held build whose parts were released = %+v, %v; want 1.2.3", k, ok)
}
p.graph.source = 8 // a later merge that did not rebuild mail
if k, ok := named("t"); !ok || k.Version != "1.2.3" {
t.Errorf("after a later merge the trunk entry = %+v, %v; want the release of its fingerprint's source", k, ok)
}
if _, ok := p.namedBuild("mail", "t", 8)("t"); ok {
t.Error("an fp-src with no release names a version")
}
_, _ = p.namedBuild("mail", "t", 8)("t")
if _, ok := p.namedBuild("mail", "t", 0)("t"); ok {
t.Error("an entry naming no fp-src, whose build.ended is not heard, names a version")
}
// The release names each artifact by its whole reference, as the catalog says it, and the parts are keyed so (A-96); the
// assigner reads the entry's fp-src from its inputs (A-419).
// A-429: a released version's build counts as done for rule 1; a kept build (no version) and an unknown one do not.
if !releasedBuild(p.namedBuild("mail", "t", 7), "t") || releasedBuild(p.namedBuild("mail", "t", 7), "k") || releasedBuild(p.namedBuild("mail", "t", 8), "t") || releasedBuild(nil, "t") {
t.Error("rule 1's released build: the release of the entry's fingerprint counts, a kept build, another source or none does not")
}
if v, _, _ := fromEntry(meshcatalog.CatalogEntry{Module: "mail", Fp: "t", Inputs: &meshcatalog.EntryInputs{Src: 9, FpSrc: 7}}); v.FpSrc != 7 || v.Src != 9 {
t.Errorf("the entry's module value carries fp-src %d and src %d, want 7 and 9", v.FpSrc, v.Src)
}
// A-421: an entry naming no fp-src takes the release whose parts are what its build.ended made.
made, _ := json.Marshal(builds.BuildEnded{Module: "mail", Fingerprint: "t", Made: map[string]string{"image": "sha256:9"}})
if err := w.ends.put(made); err != nil {
t.Fatal(err)
}
if k, ok := p.namedBuild("mail", "t", 0)("t"); !ok || k.Version != "1.2.3" {
t.Errorf("an entry naming no fp-src, its build made the released digests: %+v, %v", k, ok)
}
// A release from an earlier source than the entry's fp-src (novox 2026-11-16, 962 against 963) is still this build's when
// its parts are exactly what the build made.
if k, ok := p.namedBuild("mail", "t", 8)("t"); !ok || k.Version != "1.2.3" || k.Parts["mail:image"] != "sha256:9" {
t.Errorf("an fp-src with no release, its build made the released digests: %+v, %v", k, ok)
}
if len(logs) != 2 || !strings.Contains(logs[0], "the release of mail at fingerprint t is not heard: no version-released of it from source 8") || !strings.Contains(logs[1], "names no fp-src, and no version-released of it names the parts its build.ended made") {
t.Errorf("logs = %q, want each unheard release said once, naming the module, the fingerprint and the source", logs)
}
p.graph.ok = false
if _, ok := p.namedBuild("mail", "t", 7)("t"); ok {
t.Error("no revision kept names a release")
}
}
// A-162: the assigner knows a failed build from its `build.ended`: the error whole; a done end or none heard is not failed.
func TestTheStandingOfABuildIsHeardFromItsEnd(t *testing.T) {
w := newWorld()
say := func(e builds.BuildEnded) {
raw, _ := json.Marshal(e)
if err := w.ends.put(raw); err != nil {
t.Fatal(err)
}
}
if failed, _ := w.buildStanding("web", "fp1"); failed {
t.Error("a build nothing was heard of failed")
}
say(builds.BuildEnded{Module: "web", Fingerprint: "fp1", Outcome: builds.BuildFailed, Error: "transport fault: connection"})
if failed, why := w.buildStanding("web", "fp1"); !failed || why != "transport fault: connection" {
t.Errorf("failed end: failed %v why %q", failed, why)
}
say(builds.BuildEnded{Module: "web", Fingerprint: "fp1", Outcome: builds.BuildDone})
if failed, _ := w.buildStanding("web", "fp1"); failed {
t.Error("a later done end leaves the build failed")
}
}
@@ -0,0 +1,24 @@
package main
import (
"encoding/json"
"testing"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
)
// endDone is the builder's `build.ended` of a done build of module at fp heard by w, naming the digest of its manifest (design 47 G
// A-181: what was built is heard, never read from the builder's bucket).
func endDone(t testing.TB, w *world, module, fp, manifest string) {
t.Helper()
data, err := json.Marshal(builds.BuildEnded{Module: module, Fingerprint: fp, Outcome: builds.BuildDone, Manifest: manifest})
if err != nil {
t.Fatal(err)
}
if err := w.ends.put(data); err != nil {
t.Fatal(err)
}
}
// trunkBranch is the first watched branch the tests give the world: the code names none (design 47 G §507).
const trunkBranch = "main"
@@ -0,0 +1,72 @@
package main
import (
mma "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
mwc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshwantsclient"
plc "mesh-delivery-assigner/internal/assignment"
"mesh-delivery-assigner/internal/buckets"
)
// addedOf is the `added` of node's candidate (design 47 G A-316, §379, §421): by module, each module the candidate adds to node
// (laid over current) with no want there, the version and parts the want it would write carries, taken from the same code that
// writes a want's (namedBuild, the want's build at the fingerprint of the branch the want's code takes). A module whose build names none is not listed.
func (p *passer) addedOf(node string, laid *mma.Assignments, current map[string]mma.Assignments) map[string]mma.AddedModule {
if laid == nil {
return nil
}
placed := map[string]string{}
for _, m := range laid.Modules {
placed[m.Module] = m.Branch
}
var out map[string]mma.AddedModule
for _, module := range plc.ChangeOf(current[node], *laid).Added {
if key, err := mwc.WantKey(node, module); err != nil || p.w.has(buckets.Wants(), key) {
continue
}
// The branch the want's code takes: the one the candidate's placement names, else the module's default (groups, wants).
branch := p.w.trunkName()
if p.ends.following() {
branch = p.ends.branchOf(module, placed[module])
}
entry := p.w.trunkOf(branch)[module]
fp := entry.Fp2
if fp == "" {
p.skippedAdd(node, module, "", "the branch "+branch+" names no fingerprint of it")
continue
}
k, ok := p.namedBuild(module, fp, entry.FpSrc)(fp)
if !ok {
p.skippedAdd(node, module, fp, "no version-released of it is heard for that fingerprint, so the candidate carries no version and no parts")
continue
}
if out == nil {
out = map[string]mma.AddedModule{}
}
added := mma.AddedModule{Version: k.Version, Parts: k.Parts}
if k.Version != "" {
added.Parts = nil // a released build is named by its version alone (design 47 G A-430, A-430a)
}
out[module] = added
}
return out
}
// candidateOf is the candidate of proposal id for node: the assignments laid over it, and what it adds (addedOf).
func (p *passer) candidateOf(id, node string, laid *mma.Assignments, current map[string]mma.Assignments) mma.CandidatesByProposalNodeValue {
return mma.CandidatesByProposalNodeValue{Proposal: id, Assignments: laid, Added: p.addedOf(node, laid, current)}
}
// skippedAdd says once per node, module and fingerprint why a module the candidate adds is not listed in `added`.
func (p *passer) skippedAdd(node, module, fp, why string) {
key := node + "/" + module + "@" + fp + ": " + why
if p.skipped[key] {
return
}
if p.skipped == nil {
p.skipped = map[string]bool{}
}
p.skipped[key] = true
if p.logf != nil {
p.logf("the candidate adds %s to %s with no parts: %s (fingerprint %q)", module, node, why, fp)
}
}
@@ -0,0 +1,59 @@
package main
import (
"encoding/json"
"reflect"
"testing"
mma "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/graph"
"mesh-delivery-assigner/internal/buckets"
)
// Design 47 G A-316: the candidate of a node carries, for each module it adds there without a want, the version and parts the
// want it would write carries; a module with a want there, or a build that names none, is not listed.
func TestACandidateThatAddsAModuleCarriesItsParts(t *testing.T) {
w := newWorld()
for _, m := range []string{"mail", "web", "db"} {
w.putModule("main", m, meshcatalog.ModulesByModuleValue{Fp2: "fp-" + m, FpSrc: 7}, graph.Node{}, nil)
}
w.first = "main"
rel, _ := json.Marshal(meshcatalog.VersionReleasedEvent{Module: "mail", Source: 7, Version: "1.2.3", Artifacts: []meshcatalog.VersionArtifact{{Artifact: "mail:image", Digest: "sha256:9"}}})
if err := w.released.put(rel); err != nil {
t.Fatal(err)
}
end, _ := json.Marshal(builds.BuildEnded{Module: "db", Fingerprint: "fp-db", Made: map[string]string{"program": "sha256:3"}, KeptOn: "g14"})
if err := w.ends.put(end); err != nil {
t.Fatal(err)
}
w.put(buckets.Wants(), "want.ace.web", []byte(`{}`))
p := &passer{w: w, graph: &graphKeeper{ok: true, source: 9}} // a later merge: the release is matched by fp-src (A-419)
laid := &mma.Assignments{Node: "ace", Modules: []mma.PlacedModule{{Module: "mail"}, {Module: "web"}, {Module: "db"}, {Module: "old"}}}
current := map[string]mma.Assignments{"ace": {Node: "ace", Modules: []mma.PlacedModule{{Module: "old"}}}}
c := p.candidateOf("p1", "ace", laid, current)
want := map[string]mma.AddedModule{
"mail": {Version: "1.2.3"}, // a released build is named by its version alone (A-430a)
"db": {Parts: map[string]string{"db:program": "sha256:3"}},
}
if c.Proposal != "p1" || c.Assignments != laid || !reflect.DeepEqual(c.Added, want) {
t.Errorf("candidate = %+v, added want %+v", c, want)
}
if got := p.candidateOf("p1", "ace", nil, current); got.Added != nil {
t.Errorf("a candidate taking the key away adds %+v", got.Added)
}
// A placement on a watched branch is added at that branch's fingerprint, as the want's code takes it, not the trunk's.
w.putModule("feat", "mail", meshcatalog.ModulesByModuleValue{Fp2: "fp-feat"}, graph.Node{}, nil)
feat, _ := json.Marshal(builds.BuildEnded{Module: "mail", Fingerprint: "fp-feat", Made: map[string]string{"program": "sha256:4"}, KeptOn: "g14"})
if err := w.ends.put(feat); err != nil {
t.Fatal(err)
}
p.ends = newPipelineEnds(newMemEnds(), func() {}, t.Logf)
p.ends.trunk = w.trunkName
p.ends.on.Store(true)
onFeat := &mma.Assignments{Node: "g14", Modules: []mma.PlacedModule{{Module: "mail", Branch: "feat"}}}
if got, want := p.candidateOf("p2", "g14", onFeat, nil).Added, map[string]mma.AddedModule{"mail": {Parts: map[string]string{"mail:program": "sha256:4"}}}; !reflect.DeepEqual(got, want) {
t.Errorf("a placement on branch feat adds %+v, want %+v", got, want)
}
}
@@ -0,0 +1,113 @@
package main
import (
"context"
"encoding/json"
"errors"
"fmt"
"maps"
"strings"
mcc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-sdk/go/buscalls"
"mesh-delivery-assigner/internal/assigngraph"
)
// A run's candidate assignment graph (design 47 G §189, §190, A-201, A-235): the candidate `run-<id>`'s catalog graph revision,
// handed by meshcatalogclient's candidates hook, is read whole through the catalog seat's verb revision; the assignment graph is
// computed from it in place of its branch's half, beside every other followed branch's, and kept under candidate.<group>.<heads>;
// the runner's group-ended of the run drops it. It writes no want and says no event; the gate's heads-replaced drops nothing.
// runGroupPrefix is a run on request's candidate group before its id, `run-<id>` (A-160).
const runGroupPrefix = "run-"
// readCandidateHalf reads a candidate's catalog graph revision whole through the seat's verb revision, page by page, with the
// candidate's group and heads and the revision its event names.
func readCandidateHalf(call mcc.Call, ev meshcatalog.CatalogRevisionEvent) (mcc.Half, error) {
half := mcc.Half{Entries: map[string]meshcatalog.CatalogEntry{}}
after := ""
for {
a, err := askCandidatePage(call, meshcatalog.RevisionInput{Branch: ev.Branch, Group: ev.Group, Heads: ev.Heads, Revision: ev.Revision, After: after})
if err != nil {
return half, err
}
if a.Revision == nil || a.Revision.Revision != ev.Revision || a.Revision.Group != ev.Group {
return half, fmt.Errorf("%s answered %+v for the candidate %s's revision %d", mcc.RevisionVerb, a.Revision, ev.Group, ev.Revision)
}
half.Revision = *a.Revision
for _, e := range a.Entries {
half.Entries[e.Module] = e
}
if a.Next == "" {
return half, nil
}
after = a.Next
}
}
// keepCandidate computes and keeps the candidate's assignment graph of a run's catalog-revision; another candidate's (a try's, a
// group's) is passed over.
func (p *passer) keepCandidate(ctx context.Context, call mcc.Call, ev meshcatalog.CatalogRevisionEvent) error {
if !strings.HasPrefix(ev.Group, runGroupPrefix) {
return nil
}
g := p.graph
if g == nil || g.objects == nil || g.halves == nil {
return errors.New("the assigner keeps no assignment graph, so no candidate's is kept")
}
half, err := readCandidateHalf(call, ev)
if err != nil {
return fmt.Errorf("the candidate %s's revision %d is not read, so its assignment graph is not kept: %w", ev.Group, ev.Revision, err)
}
in := p.graphInputs()
in.Halves = maps.Clone(in.Halves)
in.Halves[half.Revision.Branch] = half
c := assigngraph.Compute(in)
for _, u := range c.Uncomputed {
p.logf("the candidate %s's assignment graph leaves out %s", ev.Group, u)
}
rev, fresh, err := assigngraph.KeepCandidate(ctx, g.objects, c, ev.Group, ev.Heads, meshcatalog.EventCatalogRevision, p.clock())
if err != nil {
return fmt.Errorf("the candidate %s's assignment graph is not kept: %w", ev.Group, err)
}
if fresh {
p.logf("the candidate %s's assignment graph revision %d is kept, from its catalog graph revision %d", ev.Group, rev.Revision, ev.Revision)
}
return nil
}
// dropCandidate removes a run's candidate assignment graph on the runner's group-ended of that run (A-235).
func (p *passer) dropCandidate(ctx context.Context, group string) error {
g := p.graph
if g == nil || g.objects == nil {
return nil
}
o, ok := g.objects.(assigngraph.Remover)
if !ok {
return fmt.Errorf("the objects %s remove nothing, so the candidate %s is kept", assigngraph.RevisionsObjects, group)
}
n, err := assigngraph.DropCandidate(ctx, o, group)
if err == nil && n > 0 {
p.logf("the candidate %s's assignment graph is dropped: its run ended", group)
}
return err
}
// askCandidatePage is one page of a candidate's revision as the seat's verb revision answers it.
func askCandidatePage(call mcc.Call, in meshcatalog.RevisionInput) (meshcatalog.RevisionAnswer, error) {
raw, err := call(mcc.RevisionVerb, in)
if err != nil {
return meshcatalog.RevisionAnswer{}, err
}
answer, said, ok := buscalls.Unwrap(raw)
if !ok {
return meshcatalog.RevisionAnswer{}, fmt.Errorf("%s answered: %s", mcc.RevisionVerb, said)
}
var a meshcatalog.RevisionAnswer
if err := json.Unmarshal(answer, &a); err != nil {
return a, fmt.Errorf("%s answered no revision: %w", mcc.RevisionVerb, err)
}
return a, nil
}
@@ -5,7 +5,7 @@ import (
"strings"
"git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
"git.novox.be/novox/mesh-delivery/contracts/go/clients/meshcatalogclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/catalogkey"
)
// Every node's published compositions, read only to compare (novox/hq ADR 0593 §8): each node's engine writes its own
@@ -44,7 +44,7 @@ func published(values map[string][]byte) map[string][]publishedRow {
_, module, part, isNode, err := nodeengineclient.ParseComposedKey(key)
var fp string
if err == nil && !isNode {
fp, err = meshcatalogclient.ParseKeyPart(part)
fp, err = catalogkey.ParseKeyPart(part)
}
switch {
case err != nil:
@@ -0,0 +1,375 @@
package main
import (
"context"
"encoding/json"
"errors"
"fmt"
"slices"
"strings"
"time"
"github.com/nats-io/nats.go/jetstream"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/nodebuildgo"
"git.novox.be/novox/mesh-sdk/go/buscalls"
)
// A composition run's bound (design 47 G §720; A-466n, A-466p, A-466q, A-466s, A-468b, A-469b, A-469s, A-469y, A-470): a run
// has one clock, the key `bound.<run key>` of composition-runs with its own time to live composition-step-bound, written at the
// build seat's ask-taken of the run's ask and written again at each step-progress of that ask; an ask still waiting in the queue
// has no clock but `untaken.<run key>`, written at the run's start with the time to live run-untaken-bound. Either's expiry,
// heard as the bus's event, ends the run: its ask dropped through the build seat's drop, the run ended could not run naming the
// ask and the bound, so every reader ends could not run with it. While the ask waits for a build node each reader is said waiting
// by a wait-held on mesh-wants (`on: build node`), ended `ran` at ask-taken or `superseded` when the run ends untaken.
// waitOnBuildNode is what a composition run's waiting reader waits on (A-469b, A-469y).
const waitOnBuildNode = "build node"
// dropVerbKey is the Go build seat's drop, asked as a kept call (§119, A-182).
const dropVerbKey = "seat:" + nodebuildgo.Seat + "." + nodebuildgo.VerbDrop
// dropOver asks the Go build seat's drop of a run ask as a kept call, of any holder, which records it (A-469s).
func dropOver(call func(key string, body any) (json.RawMessage, error)) func(ask, why string) error {
return func(ask, why string) error {
raw, err := call(dropVerbKey, nodebuildgo.DropInput{ID: ask, Why: why, By: runAsker})
if err != nil {
return err
}
if _, said, ok := buscalls.Unwrap(raw); !ok {
return fmt.Errorf("%s answered: %s", dropVerbKey, said)
}
return nil
}
}
// waitOf is a reader's wait for a build node to take its run's ask (A-469y).
func waitOf(run meshwants.CompositionRun, reader meshwants.CompositionReader) meshwants.Wait {
w := meshwants.Wait{Step: "pipeline", Owner: meshwants.Seat, Module: reader.Module, Node: run.Machine, On: waitOnBuildNode, Fp: reader.Fingerprint,
Words: fmt.Sprintf("the composition step of %s waits for a build node to take the composition run %s of %s (ask %s)", reader.Pipeline,
runKeyOf(run.Candidate, run.Machine), run.Machine, run.Ask)}
if run.Started != nil {
w.Since = *run.Started
}
return w
}
// sayWaits says, for each reader, its wait held or ended (how: ran, superseded); a wait that cannot be said is journaled.
func (r *compositionRuns) sayWaits(run meshwants.CompositionRun, readers []meshwants.CompositionReader, how string) {
if r.say == nil {
return
}
for _, c := range readers {
w := waitOf(run, c)
event, id := meshwants.EventWaitHeld, "composition."+runKeyOf(run.Candidate, run.Machine)+"."+run.Ask+"."+c.ID+".held"
if how != "" {
w.How, event, id = how, meshwants.EventWaitEnded, strings.TrimSuffix(id, ".held")+".ended"
}
if err := r.say(event, w, id); err != nil {
r.logf("the %s of %s on the composition run of %s is not said: %v", event, c.Pipeline, run.Machine, err)
}
}
}
// untaken is whether the run of ask has not been taken yet: its untaken key stands holding that ask (A-470n).
func (r *compositionRuns) untaken(key, ask string) bool {
held, _, standing, err := r.boundOf(runUntakenPrefix + key)
return err == nil && standing && held == ask
}
// boundOf reads a bound key: the ask it holds and its revision; standing false when it is not written.
func (r *compositionRuns) boundOf(boundKey string) (string, uint64, bool, error) {
raw, rev, err := r.kv.get(boundKey)
if err != nil || raw == nil {
return "", 0, false, err
}
var v boundValue
_ = json.Unmarshal(raw, &v)
return v.Ask, rev, true, nil
}
// armBound writes the bound key prefix+key holding ask, judged from a read of the run, then reads the run again (A-470n): when
// it no longer names ask, or has ended, the bound just written is deleted at its revision, so no bound written from the earlier
// read ends the run after it, and a bound another run wrote since is kept. It answers whether the bound stands for the run.
func (r *compositionRuns) armBound(prefix, key, ask string, ttl time.Duration) (bool, error) {
rev, err := r.kv.arm(prefix+key, ask, ttl)
if err != nil {
return false, err
}
run, _, ok, err := r.read(key)
if err != nil {
return false, err
}
if ok && run.Ended == nil && run.Ask == ask {
return true, nil
}
if err := r.kv.delAt(prefix+key, rev); err != nil && !errors.Is(err, errRunChanged) {
return false, err
}
return false, nil
}
// heardAskTaken begins a run's clock at its ask's ask-taken: the bound key armed holding the ask, the untaken key of that ask
// deleted, each reader's wait ended ran. An ask no running run names is another asker's, or a late signal of a run replaced or
// ended, which moves nothing and is journaled (A-470n).
func (r *compositionRuns) heardAskTaken(e nodebuildgo.AskTaken) error {
key, run, err := r.runOfAsk(e.Asker, e.Ask)
if err != nil {
return err
}
if key == "" {
r.late("ask-taken", e.Asker, e.Ask)
return nil
}
armed, err := r.armBound(runBoundPrefix, key, e.Ask, r.set.stepBound)
if err != nil {
return fmt.Errorf("the bound of the composition run %s is not armed: %w", key, err)
}
if !armed {
r.late("ask-taken", e.Asker, e.Ask)
return nil
}
if r.untaken(key, e.Ask) {
if err := r.clearBounds(key, e.Ask, runUntakenPrefix); err != nil {
return err
}
r.sayWaits(run, run.Readers, "ran")
}
return nil
}
// heardProgress begins a running run's clock again at each step-progress of its ask (§720: owed progress, not run length); a
// late one moves nothing and is journaled (A-470n).
func (r *compositionRuns) heardProgress(e nodebuildgo.StepProgress) error {
key, _, err := r.runOfAsk(e.Asker, e.Ask)
if err != nil {
return err
}
armed := false
if key != "" {
if armed, err = r.armBound(runBoundPrefix, key, e.Ask, r.set.stepBound); err != nil {
return err
}
}
if !armed {
r.late("step-progress", e.Asker, e.Ask)
}
return nil
}
// late journals a signal of an ask the assigner put whose run no key names running any more (A-470n).
func (r *compositionRuns) late(signal, asker, ask string) {
if asker == runAsker && ask != "" {
r.logf("the %s of the run ask %s is late: no composition run names it running, so it moves nothing (A-470n)", signal, ask)
}
}
// runOfAsk is the running run of an ask the assigner put, or none.
func (r *compositionRuns) runOfAsk(asker, ask string) (string, meshwants.CompositionRun, error) {
if asker != runAsker || ask == "" {
return "", meshwants.CompositionRun{}, nil
}
key, run, err := r.keyOfAsk(ask)
if err != nil || key == "" || run.Ended != nil {
return "", meshwants.CompositionRun{}, err
}
return key, run, nil
}
// expired ends the run whose bound key's time to live ended (§720): its ask dropped, the run ended could not run naming the
// ask and the bound. A run that ended already, or a key of none, takes nothing.
func (r *compositionRuns) expired(boundKey string) {
key, bound, setting := "", time.Duration(0), ""
switch {
case strings.HasPrefix(boundKey, runBoundPrefix):
key, bound, setting = strings.TrimPrefix(boundKey, runBoundPrefix), r.set.stepBound, "composition-step-bound"
case strings.HasPrefix(boundKey, runUntakenPrefix):
key, bound, setting = strings.TrimPrefix(boundKey, runUntakenPrefix), r.set.untaken, "run-untaken-bound"
default:
return
}
run, _, ok, err := r.read(key)
if err != nil || !ok || run.Ended != nil {
return
}
// The marker of an expiry holds no value (A-470o): the run ends only while its bound is still absent when read again, and
// the run is taken for bound., untaken for untaken., so an expiry heard after a bound was armed again, or of a run replaced
// since, ends nothing.
other := runUntakenPrefix
if setting == "run-untaken-bound" {
other = runBoundPrefix
}
_, _, armed, err := r.boundOf(boundKey)
if err != nil {
r.logf("the bound %s is not read again, so its expiry ends nothing: %v", boundKey, err)
return
}
held, _, standing, err := r.boundOf(other + key)
if err != nil {
r.logf("the bound %s is not read, so the expiry of %s ends nothing: %v", other+key, boundKey, err)
return
}
if armed || (standing && held == run.Ask) {
r.logf("the expiry of %s ends nothing: the bound is armed again, or the run of ask %s is not where it bounds (A-470o)", boundKey, run.Ask)
return
}
said := fmt.Sprintf("%s: its run ask %s said no progress within %s (%s)", run.Machine, run.Ask, bound, setting)
if setting == "run-untaken-bound" {
said = fmt.Sprintf("%s: its run ask %s was taken by no build node within %s (%s)", run.Machine, run.Ask, bound, setting)
}
if r.drop != nil {
if err := r.drop(run.Ask, said); err != nil {
r.logf("the drop of the run ask %s of the composition run %s is not answered: %v", run.Ask, key, err)
}
}
// The untaken key is gone with its expiry, so the run ended by it is said untaken here: its readers' waits end superseded.
if _, err := r.endRunOf(key, run.Ask, meshwants.CompositionRunOutcomeCouldNotRun, said, nil, setting == "run-untaken-bound"); err != nil {
r.logf("the composition run %s past its bound is not ended: %v", key, err)
}
}
// endRun ends a run (end) and clears its bounds: the untaken key's readers said superseded, both bound keys deleted.
func (r *compositionRuns) endRun(key, ask, outcome, said string, verdict map[string]any) (bool, error) {
return r.endRunOf(key, ask, outcome, said, verdict, r.untaken(key, ask))
}
// endRunOf is endRun of a run whose ask is untaken, or not, as its caller judged.
func (r *compositionRuns) endRunOf(key, ask, outcome, said string, verdict map[string]any, untaken bool) (bool, error) {
return r.endRunMoving(key, ask, outcome, said, verdict, untaken, true)
}
// endRunMoving is endRunOf, moving the readers a rerun carried or not: a drop says its readers' ends itself (A-470r).
func (r *compositionRuns) endRunMoving(key, ask, outcome, said string, verdict map[string]any, untaken, move bool) (bool, error) {
// The readers a rerun carried move with the run's end (§727, A-470d): chosen before the end is written, while the rerun's own
// step still waits on it, so it alone says its own end; each mover waits for the end in the key.
if moved := r.moved.Load(); moved != nil && move {
if run, _, ok, err := r.read(key); err == nil && ok && run.Ended == nil && run.Ask == ask {
(*moved)(run)
}
}
ended, err := r.end(key, ask, outcome, said, verdict)
if err != nil || !ended {
return ended, err
}
if untaken {
if run, _, ok, err := r.read(key); err == nil && ok {
r.sayWaits(run, run.Readers, "superseded")
}
}
if err := r.clearBounds(key, ask, runBoundPrefix, runUntakenPrefix); err != nil {
r.logf("the bound keys of the ended composition run %s are not deleted: %v", key, err)
}
return true, nil
}
// readersOfOpen are the readers of every run with no `ended`, each with its ask's id once: what the assigner takes up again at
// its start (§719), each reader's end said from the keys alone (A-468). A reader whose step said its end already, carried into a
// rerun's run, is taken up only when it is marked `rerun` (A-470l, A-470m); each with the ask of the open run it is taken up from.
func (r *compositionRuns) readersOfOpen() ([]openReader, error) {
all, err := r.keys()
if err != nil {
return nil, err
}
seen := map[string]bool{}
var out []openReader
for _, key := range all {
if !isRunKey(key) {
continue
}
run, _, ok, err := r.read(key)
if err != nil || !ok || run.Ended != nil {
continue
}
for _, c := range run.Readers {
if c.Ended != nil && !c.Rerun {
continue // it ended passed already: only a reader marked rerun says its end again
}
if !seen[c.ID] {
seen[c.ID] = true
out = append(out, openReader{CompositionReader: c, ask: run.Ask})
}
}
}
return out, nil
}
// openReader is a reader taken up at the start and the ask of the open run it is taken up from.
type openReader struct {
meshwants.CompositionReader
ask string
}
// keysOf are the keys of the candidate's runs that the reader reads.
func (r *compositionRuns) keysOf(candidate, id string) ([]string, error) {
all, err := r.keys()
if err != nil {
return nil, err
}
var out []string
prefix := keysPart(candidate) + "."
for _, key := range all {
if !isRunKey(key) || !strings.HasPrefix(key, prefix) {
continue
}
if run, _, ok, err := r.read(key); err == nil && ok && hasReader(run.Readers, id) {
out = append(out, key)
}
}
slices.Sort(out) // by machine, as a step names its machines
return out, nil
}
// hearRunBounds hears the build seats' ask-taken and step-progress on the assigner's durable consumer (§720, A-466q): each
// handed to the runs; one that cannot be written is given again by the bus.
func hearRunBounds(hub interface {
Handle(string, func(jetstream.Msg)) error
}, r *compositionRuns, logf func(string, ...any)) error {
if err := hub.Handle(nodebuildgo.SubjectAskTakenAll, func(m jetstream.Msg) {
var e nodebuildgo.AskTaken
if err := json.Unmarshal(m.Data(), &e); err != nil {
logf("%s holds what is no ask-taken, left: %v", m.Subject(), err)
_ = m.Ack()
return
}
ackOrNak(m, r.heardAskTaken(e), logf)
}); err != nil {
return err
}
return hub.Handle(nodebuildgo.SubjectStepProgressAll, func(m jetstream.Msg) {
var e nodebuildgo.StepProgress
if err := json.Unmarshal(m.Data(), &e); err != nil {
logf("%s holds what is no step-progress, left: %v", m.Subject(), err)
_ = m.Ack()
return
}
ackOrNak(m, r.heardProgress(e), logf)
})
}
func ackOrNak(m jetstream.Msg, err error, logf func(string, ...any)) {
if err != nil {
logf("%s is not taken, so the bus gives it again: %v", m.Subject(), err)
_ = m.Nak()
return
}
_ = m.Ack()
}
// takeUp says, at the assigner's start, the end of each reader of a run with no `ended` once its runs end (§719, A-468): the
// step's goroutine is gone, so its end is judged from the candidate's keys naming it.
func (c *compositionSteps) takeUp(ctx context.Context, r *compositionRuns) {
readers, err := r.readersOfOpen()
if err != nil {
c.logf("composition-runs: the runs standing at the start are not read, so their readers are not taken up: %v", err)
return
}
for _, reader := range readers {
c.logf("the composition step %s of %s is taken up again by its runs (ask %s)", reader.Pipeline, reader.Module, reader.ID)
again := "" // a reader whose step said its end already says it again under the open run's ask (A-470q)
if reader.Ended != nil {
again = reader.ask
}
go c.say1(ctx, reader.ID, stepRunOf(reader.CompositionReader), c.resume, again)
}
}
@@ -0,0 +1,169 @@
package main
import (
"bytes"
"context"
"crypto/rand"
"encoding/base64"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"slices"
"time"
nec "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
ne "git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
)
// The inputs of a composition run (design 47 G §354, §718, A-243, A-252): one request per candidate and machine, carrying that
// machine's input, asked of the machine's node-engine by the seat's verb compose-candidate when the run starts.
// composeCandidateKey is the seat verb's call key, asked of one node.
const composeCandidateKey = "seat:" + ne.Seat + "." + ne.VerbComposeCandidate
// candidateKeyOf is the key the step's pipeline names its candidate by (A-226): a run on request's `run-<id>`, or for a branch
// pipeline the branch's catalog graph revision `<branch>.<revision>`, the branch escaped as a key part as the pipeline key does.
func candidateKeyOf(run meshwants.StepRun) (string, error) {
switch {
case run.Run != "":
return nec.RunKey(run.Run)
case run.Branch == "" || run.Revision <= 0:
return "", errors.New("the step names neither a run on request nor a branch's revision, so no candidate is named")
}
return nec.RevisionKey(run.Branch, run.Revision) // built by the seat's client, never by hand (A-226b)
}
// machinesFor are the machines of a step (A-252): the nodes whose placement of the module names the step's branch (a placement
// naming none is the trunk's, trunk the first watched branch); a branch that is not watched takes the nodes placing the module on the trunk. In name order.
func machinesFor(placed map[string]map[string]string, module, branch, trunk string, watched bool) []string {
if branch == "" || !watched {
branch = trunk
}
var out []string
for node, b := range placed[module] {
if b == "" {
b = trunk
}
if b == branch {
out = append(out, node)
}
}
slices.Sort(out)
return out
}
// machinesOf are the machines of a composition step in the world's assignments.
func (w *world) machinesOf(module, branch string) []string {
return machinesFor(w.placedBranches(), module, branch, w.trunkName(), w.holdsBranch(branch))
}
// nodeInput is one machine's input: its bytes, or why the node gave none, or that it is away.
type nodeInput struct {
Node string
Body []byte
// Why is set when the node gave no input: its words, or the call's error.
Why string
// Away is a machine the watchman said away: it is not asked (§64).
Away bool
}
// compositionInputs asks the machines of a step for their inputs.
type compositionInputs struct {
machines func(module, branch string) []string
// callFile asks a seat verb marked chunks, addressed to one node as `seat:<seat>.<verb>@<node>`, and answers the verb's answer with
// the whole file received added as its member `file`, base64 (process.Conn.CallFile; design 47 G A-237b, A-237c, A-249). The call
// token is the body's `call`.
callFile func(key string, body any) (json.RawMessage, error)
bound time.Duration
}
// of asks the machine node for its input with the candidate's key (§718): asked only by the composition step that starts the
// machine's composition run, once per candidate and machine. A node that is silent, unready or answers no input has Why set.
func (c *compositionInputs) of(ctx context.Context, node, candidate string) nodeInput {
bound := c.bound
if bound <= 0 {
bound = nec.AnswerBound
}
return c.one(ctx, bound, node, candidate)
}
// one asks one node for its input.
func (c *compositionInputs) one(ctx context.Context, bound time.Duration, node, key string) nodeInput {
in := nodeInput{Node: node}
at, cancel := context.WithTimeout(ctx, bound)
defer cancel()
type reply struct {
raw json.RawMessage
err error
}
got := make(chan reply, 1)
go func() {
// The input is any size, so the verb sends it in chunks on the call token chosen here, and the file is the input (A-237b, A-237c).
var bits [16]byte
if _, err := rand.Read(bits[:]); err != nil {
got <- reply{nil, err}
return
}
raw, err := c.callFile(composeCandidateKey+"@"+node, ne.ComposeCandidateInput{Candidate: key, Input: true, Call: hex.EncodeToString(bits[:])})
got <- reply{raw, err}
}()
var raw json.RawMessage
select {
case <-at.Done():
in.Why = "no answer within its bound: " + at.Err().Error()
return in
case r := <-got:
if r.err != nil {
in.Why = r.err.Error()
return in
}
raw = r.raw
}
var a ne.ComposeCandidateAnswer
// its numbers as written (json.Number), so the input kept is the engine's own bytes' values
dec := json.NewDecoder(bytes.NewReader(raw))
dec.UseNumber()
if err := dec.Decode(&a); err != nil {
in.Why = "its answer is not a compose-candidate answer: " + err.Error()
return in
}
switch {
case a.Verdict == nec.Unready:
in.Why = "unready: " + a.Refused
return in
case a.Chunks == 0 && len(a.Input) == 0:
in.Why = "the engine answered no composition input"
if a.Refused != "" {
in.Why += ": " + a.Refused
}
return in
}
var body []byte
if a.Chunks > 0 {
// The composition input is the file the chunks carried, the engine's own bytes (numbers as written).
var whole struct {
File string `json:"file"`
}
if err := json.Unmarshal(raw, &whole); err != nil {
in.Why = "its answer is not a compose-candidate answer: " + err.Error()
return in
}
file, err := base64.StdEncoding.DecodeString(whole.File)
if err != nil || len(file) == 0 {
in.Why = fmt.Sprintf("the engine named %d chunks of composition input and the file received is empty or not base64: %v", a.Chunks, err)
return in
}
body = file
} else {
// An answer with the input inline (an engine before A-237b, read until the checker is removed, A-237c, G-6 §321): the object, as it was.
var err error
if body, err = json.Marshal(a.Input); err != nil {
in.Why = "its composition input cannot be encoded again: " + err.Error()
return in
}
}
in.Body = body
return in
}
@@ -0,0 +1,162 @@
package main
import (
"context"
"encoding/base64"
"encoding/json"
"errors"
"regexp"
"strings"
"sync"
"testing"
"time"
nec "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
)
// Design 47 G A-226: the candidate a step asks is `run-<id>` for a run on request, else `<branch>.<revision>`.
func TestTheCandidateKeyOfAStep(t *testing.T) {
for _, c := range []struct {
run meshwants.StepRun
want string
fail bool
}{
{run: meshwants.StepRun{Run: "r1", Branch: "main"}, want: "run-r1"},
{run: meshwants.StepRun{Branch: "feat/x", Revision: 42}, want: "feat/x.42"},
{run: meshwants.StepRun{Branch: "main", Revision: 362}, want: "main.362"},
{run: meshwants.StepRun{Branch: "main"}, fail: true},
{run: meshwants.StepRun{Branch: "main", Revision: 100000000000}, fail: true}, // a number the client's key would read as a heads hash
{run: meshwants.StepRun{Run: "a.b"}, fail: true}, // a run id the client refuses
} {
got, err := candidateKeyOf(c.run)
if (err != nil) != c.fail || got != c.want {
t.Errorf("%+v: %q, %v; want %q", c.run, got, err, c.want)
}
// A-226b: the node-engine reads every key the step names with the client's one parser.
if !c.fail {
if _, err := nec.ParseCandidateKey(got); err != nil {
t.Errorf("%+v: the key %q is refused by the seat's parser: %v", c.run, got, err)
}
}
}
}
// A-252: the machines of a step are the nodes whose placement names its branch; none named is the trunk; an unwatched branch takes
// the trunk's nodes.
func TestTheMachinesOfAStep(t *testing.T) {
placed := map[string]map[string]string{"m": {"ace": "", "g14": "feat", "novox": "main", "shanks": "feat"}, "other": {"ace": ""}}
for _, c := range []struct {
branch string
watched bool
want string
}{
{"main", true, "ace novox"},
{"feat", true, "g14 shanks"},
{"gone", false, "ace novox"},
{"", true, "ace novox"},
} {
if got := strings.Join(machinesFor(placed, "m", c.branch, trunkBranch, c.watched), " "); got != c.want {
t.Errorf("branch %q watched %v: %q, want %q", c.branch, c.watched, got, c.want)
}
}
if got := machinesFor(placed, "none", "main", trunkBranch, true); len(got) != 0 {
t.Errorf("a module placed nowhere has machines %v", got)
}
}
// §354, A-243, A-252, §64: each machine is asked compose-candidate with the step's key and input true, its numbers as written; a
// silent or unready node says why, and a machine away is not asked.
func TestAStepsInputsAreAskedOfEachMachine(t *testing.T) {
// the machines are asked side by side, so the record of what each was asked is guarded.
var mu sync.Mutex
asked := map[string]string{}
call := func(key string, body any) (json.RawMessage, error) {
raw, _ := json.Marshal(body)
key, node, _ := strings.Cut(key, "@") // addressed to one node (A-237b)
mu.Lock()
asked[node] = key + " " + string(raw)
mu.Unlock()
switch node {
case "g14":
return nil, errors.New("no responders")
case "novox":
return json.RawMessage(`{"candidate":"run-r1","node":"novox","verdict":"unready","refused":"starting","modules":[],"own":{},"took":1,"v":1}`), nil
}
return json.RawMessage(`{"candidate":"run-r1","node":"` + node + `","verdict":"composed","input":{"n":12345678901234567890,"node":"` + node + `"},"modules":[],"own":{},"took":1,"v":1}`), nil
}
c := &compositionInputs{machines: func(module, branch string) []string { return []string{"ace", "g14", "novox", "shanks"} }, callFile: call, bound: time.Second}
got, err := gatherAll(c, meshwants.StepRun{Module: "m", Branch: "main", Run: "r1"}, func(node string) bool { return node == "shanks" })
if err != nil || len(got) != 4 {
t.Fatalf("%+v %v", got, err)
}
// With a call token of 128 random bits (32 hex digits), the verb being marked chunks.
if k, body, _ := strings.Cut(asked["ace"], " "); k != "seat:node-engine.compose-candidate" ||
!regexp.MustCompile(`^\{"call":"[0-9a-f]{32}","candidate":"run-r1","input":true\}$`).MatchString(body) {
t.Errorf("asked %q", asked["ace"])
}
if got[0].Node != "ace" || got[0].Why != "" || !strings.Contains(string(got[0].Body), "12345678901234567890") {
t.Errorf("ace: %+v", got[0])
}
if !strings.Contains(got[1].Why, "no responders") || !strings.Contains(got[2].Why, "unready") || got[1].Body != nil || got[2].Body != nil {
t.Errorf("g14 and novox: %+v %+v", got[1], got[2])
}
if _, was := asked["shanks"]; was || !got[3].Away {
t.Errorf("the machine away is asked or not said away: %+v", got[3])
}
none := &compositionInputs{machines: func(string, string) []string { return nil }, callFile: call}
if _, err := gatherAll(none, meshwants.StepRun{Module: "m", Run: "r1"}, nil); err == nil {
t.Error("a step with no machine is gathered")
}
}
// A-237b: the composition input is any size, so a node names the chunks it sent and the assigner reads the file the chunked call
// received as the input, its numbers as written; a node that names chunks and sends no file is said so.
func TestAStepsInputIsTheFileOfTheNodesChunks(t *testing.T) {
input := `{"n":12345678901234567890,"big":"` + strings.Repeat("x", 1<<20) + `"}`
file := base64.StdEncoding.EncodeToString([]byte(input))
call := func(key string, body any) (json.RawMessage, error) {
_, node, _ := strings.Cut(key, "@")
answer := `{"candidate":"run-r1","node":"` + node + `","verdict":"composed","modules":[],"own":{},"took":1,"v":1,"chunks":3`
if node == "g14" {
return json.RawMessage(answer + `}`), nil // names chunks, none received
}
return json.RawMessage(answer + `,"file":"` + file + `"}`), nil
}
c := &compositionInputs{machines: func(module, branch string) []string { return []string{"ace", "g14"} }, callFile: call, bound: time.Second}
got, err := gatherAll(c, meshwants.StepRun{Module: "m", Branch: "main", Run: "r1"}, func(string) bool { return false })
if err != nil || len(got) != 2 {
t.Fatalf("%+v %v", got, err)
}
if got[0].Why != "" || string(got[0].Body) != input {
t.Errorf("ace: why %q, %d bytes, want the file received (%d bytes) as the input", got[0].Why, len(got[0].Body), len(input))
}
if !strings.Contains(got[1].Why, "chunks") || got[1].Body != nil {
t.Errorf("g14: %+v", got[1])
}
}
// gatherAll asks each machine of a step for its input as each run's start does (compositionInputs.of), side by side; a machine away
// is not asked; no machine is an error.
func gatherAll(c *compositionInputs, run meshwants.StepRun, away func(string) bool) ([]nodeInput, error) {
key, err := candidateKeyOf(run)
if err != nil {
return nil, err
}
nodes := c.machines(run.Module, run.Branch)
if len(nodes) == 0 {
return nil, errors.New("no machine")
}
out := make([]nodeInput, len(nodes))
var wg sync.WaitGroup
for i, node := range nodes {
if away != nil && away(node) {
out[i] = nodeInput{Node: node, Away: true}
continue
}
wg.Add(1)
go func() { defer wg.Done(); out[i] = c.of(context.Background(), node, key) }()
}
wg.Wait()
return out, nil
}
@@ -0,0 +1,181 @@
package main
import (
"context"
"encoding/json"
"fmt"
"strings"
"sync"
"time"
mcc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
"git.novox.be/novox/mesh-sdk/go/buscalls"
)
// The reads of a composition step (design 47 G §354, A-252, A-261): the entries of one catalog revision are read once and shared by
// every composition step of that revision, since an entry is content-addressed and a revision never changes; a read that times out
// or fails in transport is made again with a growing wait for a bounded time, said in the journal, and only then ends the step as
// could not run.
const (
// readsBound is how long a read is made again before the step could not run.
readsBound = 3 * time.Minute
// readsFirstWait and readsMaxWait bound the wait between two tries.
readsFirstWait = time.Second
readsMaxWait = 15 * time.Second
// readsKept is how many catalog revisions' halves are kept; the oldest read goes first.
readsKept = 8
)
// readKey names one revision of one watched branch.
type readKey struct {
branch string
revision int
}
// readSlot is one revision's read: done closes when half or err is set.
type readSlot struct {
done chan struct{}
half mcc.Half
err error
}
// compositionReads shares the reads of composition steps.
type compositionReads struct {
mu sync.Mutex
revs map[readKey]*readSlot
order []readKey
seats map[string]json.RawMessage // by seat and digest: the definition, raw
}
// transient says whether a read's fault is of the transport or a timeout, so that it is worth reading again.
func transient(err error, said string) bool {
text := said
if err != nil {
text = err.Error() + " " + said
}
text = strings.ToLower(text)
for _, w := range []string{"deadline exceeded", "timeout", "timed out", "no responders", "connection", "i/o", "eof", "broken pipe", "unavailable"} {
if strings.Contains(text, w) {
return true
}
}
return false
}
// callRetry calls the seat verb key, again with a growing wait while its fault is transient, for readsBound; it answers the body of
// a good answer, or the last fault.
func (r *compositionRun) callRetry(ctx context.Context, key string, body any) (json.RawMessage, string, error) {
start := r.now()
wait := readsFirstWait
for try := 1; ; try++ {
raw, err := r.call(key, body)
var inner json.RawMessage
var said string
if err == nil {
var ok bool
if inner, said, ok = buscalls.Unwrap(raw); ok {
return inner, "", nil
}
}
if !transient(err, said) {
return nil, said, err
}
if r.now().Sub(start)+wait > readsBound {
return nil, said, err
}
r.logf("composition step: %s is not read (try %d, %v %s), read again in %s", key, try, err, said, wait)
if serr := r.waitFor(ctx, wait); serr != nil {
return nil, said, serr
}
if wait *= 2; wait > readsMaxWait {
wait = readsMaxWait
}
}
}
// waitFor waits d, or until ctx ends.
func (r *compositionRun) waitFor(ctx context.Context, d time.Duration) error {
if r.sleep != nil {
return r.sleep(ctx, d)
}
t := time.NewTimer(d)
defer t.Stop()
select {
case <-ctx.Done():
return ctx.Err()
case <-t.C:
return nil
}
}
// half is the revision's half, read once for every step of it: a step that finds it being read waits for that read, and a read that
// failed is not kept, so the next step reads again.
func (r *compositionRun) half(ctx context.Context, key readKey, read func() (mcc.Half, error)) (mcc.Half, error) {
c := r.reads
c.mu.Lock()
if c.revs == nil {
c.revs = map[readKey]*readSlot{}
}
if s, ok := c.revs[key]; ok {
c.mu.Unlock()
select {
case <-s.done:
if s.err == nil {
return s.half, nil
}
case <-ctx.Done():
return mcc.Half{}, ctx.Err()
}
// The read this step waited for failed: read it here (the failed slot is already dropped).
return r.half(ctx, key, read)
}
s := &readSlot{done: make(chan struct{})}
c.revs[key] = s
c.order = append(c.order, key)
for len(c.order) > readsKept {
delete(c.revs, c.order[0])
c.order = c.order[1:]
}
c.mu.Unlock()
s.half, s.err = read()
if s.err != nil {
c.mu.Lock()
if c.revs[key] == s {
delete(c.revs, key)
}
for i, k := range c.order {
if k == key {
c.order = append(c.order[:i], c.order[i+1:]...)
break
}
}
c.mu.Unlock()
}
close(s.done)
return s.half, s.err
}
// seatKept is the definition kept of a seat at a digest.
func (c *compositionReads) seatKept(seat, digest string) (json.RawMessage, bool) {
c.mu.Lock()
defer c.mu.Unlock()
d, ok := c.seats[seat+"@"+digest]
return d, ok
}
func (c *compositionReads) keepSeat(seat, digest string, def json.RawMessage) {
c.mu.Lock()
defer c.mu.Unlock()
if c.seats == nil {
c.seats = map[string]json.RawMessage{}
}
c.seats[seat+"@"+digest] = def
}
func unreadErr(what string, err error, said string) error {
if err != nil {
return fmt.Errorf("%s: %w", what, err)
}
return fmt.Errorf("%s: %s", what, said)
}
@@ -0,0 +1,635 @@
package main
import (
"context"
"encoding/json"
"errors"
"fmt"
"slices"
"strings"
"sync"
"time"
"github.com/nats-io/nats.go/jetstream"
ne "git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
mcc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
meshcatalog "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/composer"
"git.novox.be/novox/mesh-sdk/go/keys"
)
// The run of a composition step (design 47 G §354, §63, §64, §718; A-226, A-238, A-240, A-252, A-254, A-261): the step reads one
// composition run per machine of its candidate (compositionruns.go), and the step that starts a machine's run composes it: one
// compose-candidate ask of the node, one composer.Request, depth compose, the one machine and one case `change`, its manifests,
// verdicts and seats from the step's catalog revision read through mesh-catalog's `revision`, kept once in `inputs`; one run ask
// of the seat node-build-go, naming no head, its program the node-engine build's catalog entry with the composer's package,
// chosen once and recorded in the run. The run's end is heard on the build seat's step-ended of that ask, its answer (a
// composer.Verdict) read from `output`, and written in the run's key, whose change every reading step hears. A machine the
// watchman said away (machine-away) is not composed and passes with a warning (§64).
const (
// runAsker is the assigner's name as an asker of a build seat, its seat's own name: the last token of the subject its run
// asks are put on and the first of their step keys (§467, §481, §600, A-163).
runAsker = meshwants.Seat
// changeCase is the one case each request composes.
changeCase = "change"
// inputVerbKey is the verb a run ask's input is served on: the seat mesh-wants' input (§354).
inputVerbKey = "seat:" + meshwants.Seat + "." + meshwants.VerbInput
// entryVerbKey and seatDefinitionsKey are the mesh-catalog seat verbs the step reads.
entryVerbKey = "seat:" + meshcatalog.Seat + "." + meshcatalog.VerbEntry
seatDefinitionsKey = "seat:" + meshcatalog.Seat + "." + meshcatalog.VerbSeatDefinitions
)
// compositionRun runs a composition step.
type compositionRun struct {
// runs are the composition runs of the state composition-runs (compositionruns.go).
runs *compositionRuns
inputs *compositionInputs
keeper *inputKeeper
// call asks a seat verb held once for the mesh (process.Conn.CallKept).
call func(key string, body any) (json.RawMessage, error)
// trunk is the trunk's catalog half as the assigner holds it.
trunk func() (mcc.Half, bool)
// running is the last `running` heard of a module on a node (world.runningOf), never the node-engine's bucket.
running func(node, module string) (ne.Running, bool)
// away says the watchman holds machine away (machine-away, not back since): the one presence the assigner keeps (world.awayNow),
// so a durable on the watchman's streams has one hearer.
away func(machine string) bool
// put puts a run ask on the build seat's check queue under the assigner's name.
put func(ctx context.Context, a buildstep.StepAsk) error
// reads shares the catalog reads among steps (compositionreads.go); sleep waits between two tries of a read (nil: a timer).
reads *compositionReads
sleep func(ctx context.Context, d time.Duration) error
// ask asks a seat verb on one node, for the run's answer kept as the build seat's object (buildstep.StepEnded.ReadOutput).
ask buildstep.AskVerb
now func() time.Time
logf func(string, ...any)
}
// machineEnd is what one machine came to.
type machineEnd struct {
failed, couldNot string
warnings []string
// judged is set where the composer judged the machine, composing or not (A-467a).
judged bool
}
// run runs one composition step and answers what it came to: per machine not away it joins or starts the candidate's
// composition run (§718), waits for each run's end in its key, and judges each machine from it; failed when a machine does not
// compose, could not run when a machine could not be composed or was not judged, else passed with a warning per machine away.
func (r *compositionRun) run(ctx context.Context, id string, step meshwants.StepRun) stepOutcome {
candidate, err := candidateKeyOf(step)
if err != nil {
return couldNotRun(err.Error())
}
nodes := r.inputs.machines(step.Module, step.Branch)
if len(nodes) == 0 {
return couldNotRun(fmt.Sprintf("no node places %s on the branch %q, so the composition step has no machine to compose", step.Module, step.Branch))
}
reader := readerOf(id, step)
prep := &runPrep{r: r, step: step}
var ends []machineEnd
var keys []string
for _, node := range nodes {
if r.away != nil && r.away(node) {
ends = append(ends, machineEnd{warnings: []string{node + " is away (the watchman's machine-away), so it is not composed"}})
continue
}
join := r.runs.join
if step.Rerun { // a step asked again (§727)
join = r.runs.rejoin
}
j, err := join(reader, candidate, node, buildstep.NewID())
if err != nil {
ends = append(ends, machineEnd{couldNot: node + ": " + err.Error()})
continue
}
if j.started {
go r.start(ctx, j.key, j.run, prep)
}
keys = append(keys, j.key)
}
return r.read(ctx, step.Module, keys, ends)
}
// read waits for the end of each run of keys and judges the step of module from them, naming in its progress and its end the
// runs it reads and their asks (§723, §729).
func (r *compositionRun) read(ctx context.Context, module string, keys []string, ends []machineEnd) stepOutcome {
setShared(ctx, r.runs.sharedOf(keys, nil))
setPhase(ctx, meshwants.StepProgressEventPhaseRun)
runs := r.runs.await(ctx, keys)
setPhase(ctx, meshwants.StepProgressEventPhaseReport)
for _, key := range keys {
ends = append(ends, judgeRun(module, runs[key]))
}
out := outcomeOf(ends)
out.Shared = r.runs.sharedOf(keys, runs)
return out
}
// resume judges a step taken up at the assigner's start (§719, A-468): the runs of its candidate naming it, once each has ended.
func (r *compositionRun) resume(ctx context.Context, id string, step meshwants.StepRun) stepOutcome {
candidate, err := candidateKeyOf(step)
if err != nil {
return couldNotRun(err.Error())
}
keys, err := r.runs.keysOf(candidate, id)
if err != nil {
return couldNotRun("the step's composition runs are not read: " + err.Error())
}
return r.read(ctx, step.Module, keys, nil)
}
// outcomeOf is a step's outcome from its machines: failed before could not run before passed (§354); a step that judged no
// machine never passes (A-467a), each machine not judged named with why.
func outcomeOf(ends []machineEnd) stepOutcome {
var out stepOutcome
var failed, couldNot []string
judged := 0
for _, e := range ends {
if e.judged {
judged++
}
failed = appendSome(failed, e.failed)
couldNot = appendSome(couldNot, e.couldNot)
out.Warnings = append(out.Warnings, e.warnings...)
}
switch {
case len(failed) > 0:
out.Outcome, out.Said = meshwants.StepEndedOutcomeFailed, strings.Join(failed, "; ")
case len(couldNot) > 0:
out.Outcome, out.Said = meshwants.StepEndedOutcomeCouldNotRun, strings.Join(couldNot, "; ")
case judged == 0:
said := "no machine was judged"
if len(out.Warnings) == 0 {
said += ": the step has no machine"
} else {
said += ": " + strings.Join(out.Warnings, "; ")
}
out.Outcome, out.Said = meshwants.StepEndedOutcomeCouldNotRun, said
default:
out.Outcome = meshwants.StepEndedOutcomePassed
}
return out
}
func appendSome(to []string, s string) []string {
if s == "" {
return to
}
return append(to, s)
}
func couldNotRun(said string) stepOutcome {
return stepOutcome{Outcome: meshwants.StepEndedOutcomeCouldNotRun, Said: said}
}
// runPrep is what the step that starts a run reads of its catalog revision, once for every machine it starts: the seats, the
// case's manifests and verdicts, and the composer program per machine.
type runPrep struct {
r *compositionRun
step meshwants.StepRun
once sync.Once
// read once
seats []json.RawMessage
manifests map[string]composer.Manifest
verdicts map[string]json.RawMessage
none map[string]string
programOf func(node string) (buildstep.RunProgram, string, error)
err error
}
func (p *runPrep) get(ctx context.Context) error {
p.once.Do(func() {
half, err := p.r.revision(ctx, p.step)
if err != nil {
p.err = errors.New("the step's catalog revision is not read: " + err.Error())
return
}
if p.seats, p.err = p.r.seats(ctx, half.Revision.Definitions); p.err != nil {
return
}
if p.manifests, p.verdicts, p.none, p.err = caseOf(half); p.err != nil {
return
}
p.programOf, p.err = p.r.programs(ctx, half)
})
return p.err
}
// start composes the machine of the run it started (§718): the node's input of this moment, its request kept once in `inputs`,
// the composer program chosen and recorded with the request's digest, and one run ask put. A fault ends the run could not run.
func (r *compositionRun) start(ctx context.Context, key string, run meshwants.CompositionRun, prep *runPrep) {
node, ask := run.Machine, run.Ask
end := func(said string) {
if _, err := r.runs.endRun(key, ask, meshwants.CompositionRunOutcomeCouldNotRun, said, nil); err != nil {
r.logf("the composition run %s is not ended: %v", key, err)
}
}
if err := prep.get(ctx); err != nil {
end(node + ": " + err.Error())
return
}
in := r.inputs.of(ctx, node, run.Candidate)
if in.Why != "" {
end(node + " gave no composition input: " + in.Why)
return
}
program, engineFp, err := prep.programOf(node)
if err != nil {
end(node + ": " + err.Error())
return
}
req := composer.Request{V: composer.Version, Input: in.Body, Depth: composer.DepthCompose, Machines: []string{node},
Cases: []composer.Case{{Name: changeCase, Manifests: prep.manifests, Verdicts: prep.verdicts, None: prep.none}}, Seats: prep.seats,
BlameTries: r.runs.set.blameTries} // the composer's bound of its search for culprits (§721, A-466r)
raw, err := json.Marshal(req)
if err != nil {
end(node + ": its request cannot be encoded: " + err.Error())
return
}
digest, err := r.keeper.keep(ask, raw)
if err != nil {
r.logf("the composition request of %s is refused: %v", node, err)
end(node + ": its request is not kept: " + err.Error())
return
}
ref, err := buildstep.RunInputOf(inputVerbKey, raw)
if err != nil {
end(node + ": " + err.Error())
return
}
if _, _, err := r.runs.change(key, func(c *meshwants.CompositionRun) bool {
if c.Ask != ask || c.Ended != nil {
return false
}
c.Program = &meshwants.CompositionRunProgram{Repository: program.Repository, Commit: program.Commit, Directory: program.Dir, Fingerprint: engineFp}
c.Input = digest
return true
}); err != nil {
end(node + ": the run's program and input are not written: " + err.Error())
return
}
a := buildstep.StepAsk{ID: ask, Kind: buildstep.AskCheck, Language: buildstep.AskGo, Asker: runAsker, At: r.now().UTC(),
Run: &buildstep.RunJob{Program: program, Heads: []buildstep.RunHead{}, Input: ref, Reader: "the composition of " + node + " by the node-engine at " + program.Commit}}
if err := r.put(ctx, a); err != nil {
end(node + ": its run ask " + ask + " is not put: " + err.Error())
}
}
// notTried is the problem the composer names a module with that its search for culprits did not try, past the request's
// blame_tries (design 47 G §721; the composer's composer.NotTried in mesh-host, compared by its words, A-470b).
const notTried = "not tried: the search reached its bound"
// judgeRun judges one machine of the step of module from the run it read (§721, §722): could not run with the run's words; else
// from the machine's composer verdict: not judged is could not run (A-467); a verdict blaming the step's module fails it, or is
// could not run where the module was not tried (A-470b); a machine that does not compose and blames no module fails every step on
// it, on the node's own account; a verdict with no `blamed` (a composer before §721) is judged as before, with the warning "the
// composer names no culprits"; otherwise the machine passes, with a warning for each other module blamed there.
func judgeRun(module string, run meshwants.CompositionRun) machineEnd {
node := run.Machine
if run.Ended == nil {
return machineEnd{couldNot: node + ": the step stopped before its composition run " + runKeyOf(run.Candidate, node) + " ended"}
}
if run.Outcome != meshwants.CompositionRunOutcomePassed {
return machineEnd{couldNot: run.Said}
}
m, err := machineOf(run.Verdict)
if err != nil {
return machineEnd{couldNot: node + ": the run's verdict does not read: " + err.Error()}
}
if m.NotJudged != "" { // a step never passes on a machine it did not judge (A-467)
return machineEnd{couldNot: node + " was not judged: " + m.NotJudged}
}
why := strings.Join(appendSome(append(slices.Clone(m.Problems), m.Refusals...), m.Reason), "; ")
switch {
case m.Blamed == nil && !m.Composes: // an old composer (§721)
return machineEnd{judged: true, failed: node + " does not compose: " + why, warnings: []string{node + ": the composer names no culprits"}}
case len(m.Blamed) == 0 && !m.Composes: // the node's own account (A-452)
return machineEnd{judged: true, failed: node + " does not compose and blames no module: " + why}
}
end := machineEnd{judged: true}
var own, others []string
for _, b := range m.Blamed {
switch {
case b.Module == module && b.Problem == notTried:
end.couldNot = fmt.Sprintf("%s holds %s untried: the composer's search for culprits reached its bound of blame_tries (A-470b)", node, module)
case b.Module == module:
own = append(own, b.Problem)
default:
others = append(others, node+" holds "+b.Module+": "+b.Problem)
}
}
if len(own) > 0 {
end.failed, end.couldNot = node+" holds "+module+": "+strings.Join(own, "; "), ""
}
end.warnings = others
return end
}
// machineOf is the composer's verdict of one machine as a run keeps it.
func machineOf(v map[string]any) (composer.Machine, error) {
var m composer.Machine
raw, err := json.Marshal(v)
if err == nil {
err = json.Unmarshal(raw, &m)
}
return m, err
}
// runVerdict reads the composer's answer of one machine: its verdict as the run keeps it, or why it is none.
func runVerdict(node string, answer []byte) (map[string]any, string) {
var v composer.Verdict
if err := json.Unmarshal(answer, &v); err != nil {
return nil, node + ": the composer answered no verdict: " + err.Error()
}
if v.V != composer.Version {
return nil, fmt.Sprintf("%s: the composer answered a verdict of version %d, the assigner reads %d", node, v.V, composer.Version)
}
for _, c := range v.Cases {
if c.Name != changeCase {
continue
}
m, ok := c.Machines[node]
if !ok {
return nil, node + ": the composer's verdict names no such machine"
}
raw, err := json.Marshal(m)
var out map[string]any
if err == nil {
err = json.Unmarshal(raw, &out)
}
if err != nil {
return nil, node + ": the composer's verdict cannot be kept: " + err.Error()
}
return out, ""
}
return nil, node + ": the composer's verdict has no case " + changeCase
}
// revision reads the step's catalog revision whole, page by page, through mesh-catalog's `revision` (A-252), once for every step of
// it (compositionreads.go).
func (r *compositionRun) revision(ctx context.Context, run meshwants.StepRun) (mcc.Half, error) {
if run.Revision <= 0 {
return mcc.Half{}, errors.New("the step names no catalog revision")
}
return r.half(ctx, readKey{run.Branch, int(run.Revision)}, func() (mcc.Half, error) { return r.readRevision(ctx, run) })
}
func (r *compositionRun) readRevision(ctx context.Context, run meshwants.StepRun) (mcc.Half, error) {
half := mcc.Half{Entries: map[string]meshcatalog.CatalogEntry{}}
in := meshcatalog.RevisionInput{Branch: keys.EscapeName(run.Branch), Revision: run.Revision}
for {
body, said, err := r.callRetry(ctx, mcc.RevisionVerb, in)
if err != nil {
return mcc.Half{}, err
}
if body == nil {
return mcc.Half{}, fmt.Errorf("%s answered: %s", mcc.RevisionVerb, said)
}
var a meshcatalog.RevisionAnswer
if err := json.Unmarshal(body, &a); err != nil {
return mcc.Half{}, fmt.Errorf("%s answered no revision: %w", mcc.RevisionVerb, err)
}
if a.NoneYet || a.Revision == nil || a.Revision.Revision != run.Revision {
return mcc.Half{}, fmt.Errorf("%s answered no revision %d of %q", mcc.RevisionVerb, run.Revision, run.Branch)
}
if in.After == "" {
half.Revision = *a.Revision // the first page names what the revision was read from, its definitions included
}
for _, e := range a.Entries {
half.Entries[e.Module] = e
}
if a.Next == "" {
return half, nil
}
in.After = a.Next
}
}
// seats are the definitions the composer is handed, raw. A revision that names definitions (A-261): the definition of each (seat, digest)
// pair, from mesh-catalog's seat-definitions where the trunk's digest is the revision's; a digest neither holds is an error naming the seat
// and the digest. A revision that names none (A-234's stand-in, A-467): every definition of the trunk seat list, read through
// seat-definitions; a list or a definition that cannot be read is an error naming it, never an empty list.
func (r *compositionRun) seats(ctx context.Context, defs []meshcatalog.CatalogRevisionDefinitionsItem) ([]json.RawMessage, error) {
if len(defs) == 0 {
return r.trunkSeats(ctx)
}
out := make([]json.RawMessage, 0, len(defs))
for _, d := range defs {
def, err := r.seatAt(ctx, d.Seat, d.Digest)
if err != nil {
return nil, err
}
out = append(out, def)
}
return out, nil
}
// trunkSeats are the definitions of every seat of the trunk's seat list (seat-definitions with no seat names them with their digests).
func (r *compositionRun) trunkSeats(ctx context.Context) ([]json.RawMessage, error) {
what := "the trunk's seat list is not read"
body, said, err := r.callRetry(ctx, seatDefinitionsKey, meshcatalog.SeatDefinitionsInput{})
if err != nil || body == nil {
return nil, unreadErr(what, err, said)
}
var list meshcatalog.SeatDefinitionsAnswer
if err := json.Unmarshal(body, &list); err != nil {
return nil, fmt.Errorf("%s: %w", what, err)
}
if len(list.Seats) == 0 {
return nil, errors.New(what + ": mesh-catalog's seat-definitions names no seat, so the composer has no seat list to judge by")
}
out := make([]json.RawMessage, 0, len(list.Seats))
for _, s := range list.Seats {
def, err := r.seatAt(ctx, s.Seat, s.Digest)
if err != nil {
return nil, err
}
out = append(out, def)
}
return out, nil
}
// seatAt is the definition of a seat at a digest, kept once read (a definition at a digest never changes).
func (r *compositionRun) seatAt(ctx context.Context, seat, digest string) (json.RawMessage, error) {
if def, ok := r.reads.seatKept(seat, digest); ok {
return def, nil
}
what := "the definition of the seat " + seat + " is not read"
body, said, err := r.callRetry(ctx, seatDefinitionsKey, meshcatalog.SeatDefinitionsInput{Seat: seat})
if err != nil || body == nil {
return nil, unreadErr(what, err, said)
}
var a meshcatalog.SeatDefinitionsAnswer
if err := json.Unmarshal(body, &a); err != nil {
return nil, fmt.Errorf("%s: %w", what, err)
}
if a.Entry == nil || a.Entry.Digest != digest || a.Entry.Definition == nil {
return nil, fmt.Errorf("no definition of the seat %s with the digest %s is held: neither the revision nor the trunk holds it", seat, digest)
}
def, err := json.Marshal(a.Entry.Definition)
if err != nil {
return nil, err
}
r.reads.keepSeat(seat, digest, def)
return def, nil
}
// caseOf is the case's manifests, verdicts and none from the revision's entries: each manifest whole, the verdict of each one not
// accepted (a module without one is accepted), and the revision's none words of each module it gives no fingerprint, whose
// build can never be made (design 47 G A-470j, A-470k).
func caseOf(half mcc.Half) (map[string]composer.Manifest, map[string]json.RawMessage, map[string]string, error) {
manifests := map[string]composer.Manifest{}
verdicts := map[string]json.RawMessage{}
var none map[string]string
for name, e := range half.Entries {
if len(e.Manifest) == 0 {
continue
}
raw, err := json.Marshal(e.Manifest)
if err != nil {
return nil, nil, nil, fmt.Errorf("the manifest of %s cannot be encoded: %w", name, err)
}
manifests[name] = composer.Manifest{Raw: raw}
if e.Fp == "" && e.None != "" {
if none == nil {
none = map[string]string{}
}
none[name] = e.None
}
if e.Verdict == "" || e.Verdict == mcc.VerdictAccepted {
continue
}
v := meshcatalog.VerdictsByDigestValue{V: 1, Module: name, State: e.Verdict}
if e.Verdict != mcc.VerdictRefused {
v.State = mcc.VerdictManifestWaits
}
if e.Inputs != nil {
v.Problems, v.Unknown, v.Warnings = e.Inputs.Problems, e.Inputs.Unknown, e.Inputs.Warnings
}
raw, err = json.Marshal(v)
if err != nil {
return nil, nil, nil, err
}
verdicts[name] = raw
}
return manifests, verdicts, none, nil
}
// nodeEngineEntry is the entry of the module that claims the seat node-engine, or false.
func nodeEngineEntry(entries map[string]meshcatalog.CatalogEntry) (meshcatalog.CatalogEntry, bool) {
for _, name := range slices.Sorted(mapsKeys(entries)) {
for _, s := range entries[name].Serves {
// The catalog writes a served seat verb as `seat:<seat>.<verb>` (as the compose words above are made).
if strings.HasPrefix(strings.TrimPrefix(s, "seat:"), ne.Seat+".") {
return entries[name], true
}
}
}
return meshcatalog.CatalogEntry{}, false
}
func mapsKeys(m map[string]meshcatalog.CatalogEntry) func(func(string) bool) {
return func(yield func(string) bool) {
for k := range m {
if !yield(k) {
return
}
}
}
}
// programOfEntry is the composer built from a node-engine entry: its repository, commit and directory, the composer's package.
func programOfEntry(e meshcatalog.CatalogEntry) (buildstep.RunProgram, error) {
dir := e.Path
if dir == "" {
dir = "."
}
if e.Repository == "" || e.Commit == "" {
return buildstep.RunProgram{}, fmt.Errorf("the node-engine's entry %s names no repository or commit", e.Fp)
}
return buildstep.RunProgram{Repository: e.Repository, Commit: e.Commit, Dir: dir, Package: composer.Package}, nil
}
// programs answers, per machine, the composer its run builds and the node-engine fingerprint it was chosen from (A-226, A-243,
// A-252, §719): where the revision's node-engine entry differs from the trunk's, that build for every machine; else the build the
// machine's node-engine runs, as its `running` says, its entry read through mesh-catalog's `entry`; a machine whose node-engine's
// `running` is not heard gets the revision's entry, said (A-451).
func (r *compositionRun) programs(ctx context.Context, half mcc.Half) (func(node string) (buildstep.RunProgram, string, error), error) {
engine, ok := nodeEngineEntry(half.Entries)
if !ok {
return nil, fmt.Errorf("the catalog revision %d holds no module claiming the seat %s", half.Revision.Revision, ne.Seat)
}
if trunk, ok := r.trunk(); !ok || func() bool { t, ok := nodeEngineEntry(trunk.Entries); return !ok || t.Fp != engine.Fp }() {
p, err := programOfEntry(engine)
return func(string) (buildstep.RunProgram, string, error) { return p, engine.Fp, err }, nil
}
var mu sync.Mutex
byFp := map[string]buildstep.RunProgram{}
return func(node string) (buildstep.RunProgram, string, error) {
running, ok := r.running(node, engine.Module)
if !ok || running.Fingerprint == "" {
r.logf("%s: no build of %s is heard running there, so its composer is the catalog revision's entry %s (A-451)", node,
engine.Module, engine.Fp)
p, err := programOfEntry(engine)
return p, engine.Fp, err
}
fp := running.Fingerprint
mu.Lock()
p, ok := byFp[fp]
mu.Unlock()
if ok {
return p, fp, nil
}
what := "the entry of the node-engine's build " + fp + " is not read"
body, said, err := r.callRetry(ctx, entryVerbKey, meshcatalog.EntryInput{Fingerprint: fp})
if err != nil || body == nil {
return buildstep.RunProgram{}, fp, unreadErr(what, err, said)
}
var a meshcatalog.EntryAnswer
if err := json.Unmarshal(body, &a); err != nil {
return buildstep.RunProgram{}, fp, fmt.Errorf("%s: %w", what, err)
}
p, err = programOfEntry(a.Entry)
if err != nil {
return p, fp, err
}
mu.Lock()
byFp[fp] = p
mu.Unlock()
return p, fp, nil
}, nil
}
// trunkOf is the trunk's catalog half the assigner's views hold, trunk naming the first watched branch, or false while none is
// held.
func trunkOf(iv *catalogViews, trunk func() string) func() (mcc.Half, bool) {
return func() (mcc.Half, bool) {
if iv == nil || iv.h == nil {
return mcc.Half{}, false
}
h, ok := iv.h.views()[trunk()]
return h, ok
}
}
// runAskPublisher puts a run ask on the Go build seat's check queue under the assigner's name (`accept.check.assigner`, §600), its
// id the message id, so the stream takes it once.
func runAskPublisher(js jetstream.JetStream) func(ctx context.Context, a buildstep.StepAsk) error {
return func(ctx context.Context, a buildstep.StepAsk) error {
raw, err := buildstep.EncodeStepAsk(a)
if err != nil {
return err
}
subject, err := buildstep.AskSubjectBy(a.Language, a.Kind, a.Asker)
if err != nil {
return err
}
_, err = js.Publish(ctx, subject, raw, jetstream.WithMsgID(a.ID))
return err
}
}
@@ -0,0 +1,575 @@
package main
import (
"context"
"encoding/json"
"errors"
"slices"
"strings"
"sync"
"testing"
"time"
ne "git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
mcc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
meshcatalog "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/composer"
)
const (
commitE1 = "1111111111111111111111111111111111111111"
commitE2 = "2222222222222222222222222222222222222222"
commitE3 = "3333333333333333333333333333333333333333"
)
// runStand is a composition run over stand-ins of the mesh-catalog seat, the machines' engines, the build seat and its step-ended.
type runStand struct {
mu sync.Mutex
asks map[string]buildstep.StepAsk // by node
requests map[string]composer.Request // by node
entries []string // the fingerprints `entry` was asked
r *compositionRun
runs *compositionRuns
puts int // the run asks put
// noDefinitions: the revision names no seat definition (A-234's stand-in); trunkSeats: the trunk's seat list as (seat, digest)
// pairs; unjudged: the machine the composer does not judge; listFault: the trunk's seat list cannot be read.
noDefinitions bool
trunkSeats []meshcatalog.SeatDefinitionsAnswerSeatsItem
unjudged string
listFault error
// verdict, when set, is the composer's verdict of a machine (by node), else the stand's own.
verdict func(node string) (composer.Machine, bool)
}
func newRunStand(t *testing.T, revisionEngine, trunkEngine, seatDigest string) *runStand {
s := &runStand{asks: map[string]buildstep.StepAsk{}, requests: map[string]composer.Request{}}
engine := func(fp, commit string) meshcatalog.CatalogEntry {
return meshcatalog.CatalogEntry{Module: "engine", Fp: fp, Repository: "novox/mesh-host", Commit: commit, Path: ".", Serves: []string{ne.Seat + ".composition"},
Manifest: map[string]any{"module": "engine"}}
}
revisionCommit := commitE1
if revisionEngine != "src2:e1" {
revisionCommit = commitE3
}
pages := map[string]meshcatalog.RevisionAnswer{
"": {Revision: &meshcatalog.CatalogRevision{Revision: 7, Branch: "main", Definitions: []meshcatalog.CatalogRevisionDefinitionsItem{{Seat: "s1", Digest: "d1"}}},
Entries: []meshcatalog.CatalogEntry{engine(revisionEngine, revisionCommit), {Module: "bad", Verdict: mcc.VerdictRefused, Inputs: &meshcatalog.EntryInputs{Problems: []string{"no seat x"}},
Manifest: map[string]any{"module": "bad"}}}, Next: "bad"},
"bad": {Revision: &meshcatalog.CatalogRevision{Revision: 7}, Entries: []meshcatalog.CatalogEntry{{Module: "m", Verdict: mcc.VerdictAccepted, Manifest: map[string]any{"module": "m"}},
{Module: "lidarr", None: "builders disagree: node", Manifest: map[string]any{"module": "lidarr"}}}}, // no fingerprint (A-470j)
}
call := func(key string, body any) (json.RawMessage, error) {
raw, _ := json.Marshal(body)
switch key {
case mcc.RevisionVerb:
var in meshcatalog.RevisionInput
_ = json.Unmarshal(raw, &in)
if in.Revision != 7 || in.Branch != "main" {
return nil, errors.New("asked another revision")
}
page := pages[in.After]
if s.noDefinitions && page.Revision != nil {
rev := *page.Revision
rev.Definitions = nil
page.Revision = &rev
}
return json.Marshal(page)
case seatDefinitionsKey:
var sin meshcatalog.SeatDefinitionsInput
_ = json.Unmarshal(raw, &sin)
if sin.Seat == "" {
if s.listFault != nil {
return nil, s.listFault
}
return json.Marshal(meshcatalog.SeatDefinitionsAnswer{Seats: s.trunkSeats})
}
return json.Marshal(meshcatalog.SeatDefinitionsAnswer{Found: true, Entry: &meshcatalog.SeatDefinitionsAnswerEntry{Seat: "s1", Digest: seatDigest, Definition: map[string]any{"seat": "s1"}}})
case entryVerbKey:
var in meshcatalog.EntryInput
_ = json.Unmarshal(raw, &in)
s.mu.Lock()
s.entries = append(s.entries, in.Fingerprint)
s.mu.Unlock()
commit := map[string]string{"src2:e1": commitE1, "src2:e2": commitE2}[in.Fingerprint]
return json.Marshal(meshcatalog.EntryAnswer{Entry: engine(in.Fingerprint, commit)})
}
return nil, errors.New("no such verb " + key)
}
engines := func(key string, _ any) (json.RawMessage, error) {
_, node, _ := strings.Cut(key, "@") // addressed to one node (A-237b)
return json.RawMessage(`{"candidate":"main.7","node":"` + node + `","verdict":"composed","input":{"node":"` + node + `"},"modules":[],"own":{},"took":1,"v":1}`), nil
}
running := map[string]string{"ace": "src2:e1", "g14": "src2:e2"}
away := func(machine string) bool { return machine == "shanks" }
keeper := testKeeper(&objectsMem{objs: map[string][]byte{}}, time.Now)
s.runs = newCompositionRuns(newRunsMem(), defaultRunSettings, time.Now, t.Logf)
s.r = &compositionRun{runs: s.runs,
inputs: &compositionInputs{machines: func(string, string) []string { return []string{"ace", "g14", "shanks"} }, callFile: engines, bound: time.Second},
keeper: keeper, reads: &compositionReads{}, call: call, away: away, now: time.Now, logf: t.Logf,
trunk: func() (mcc.Half, bool) {
return mcc.Half{Entries: map[string]meshcatalog.CatalogEntry{"engine": engine(trunkEngine, commitE1)}}, true
},
running: func(node, module string) (ne.Running, bool) {
fp, ok := running[node]
return ne.Running{Node: node, Module: module, Fingerprint: fp}, ok && module == "engine"
},
put: func(_ context.Context, a buildstep.StepAsk) error {
body, err := keeper.body(a.Run.Input.Digest)
if err != nil {
return err
}
req, err := composer.Decode(body)
if err != nil {
return err
}
node := req.Machines[0]
s.mu.Lock()
s.asks[node], s.requests[node] = a, req
s.mu.Unlock()
m := composer.Machine{Composes: true}
override, set := composer.Machine{}, false
if s.verdict != nil {
override, set = s.verdict(node)
}
if set {
m = override
} else if node == s.unjudged {
m = composer.Machine{NotJudged: "the composer was handed no seat list"}
} else if node == "g14" {
m = composer.Machine{Reason: "two modules own one path", Problems: []string{"/etc/x is m's and bad's"}}
}
v, _ := json.Marshal(composer.Verdict{V: composer.Version, Cases: []composer.CaseVerdict{{Name: changeCase, Machines: map[string]composer.Machine{node: m}}}})
s.mu.Lock()
s.puts++
s.mu.Unlock()
go func() {
if err := s.runs.heardEnd(buildstep.StepEnded{Ask: a.ID, Asker: runAsker, Node: "builder1", Outcome: buildstep.OutcomePassed, Output: string(v)},
func(e buildstep.StepEnded) ([]byte, error) { return []byte(e.Output), nil }); err != nil {
t.Error(err)
}
}()
return nil
},
}
return s
}
// Design 47 G §354, §63, §64, A-226, A-238, A-240, A-243, A-252, A-254, A-261: one request and one run ask per machine, the request
// depth compose with the one machine and one case `change`, its manifests, verdicts and seats from the step's revision; the
// composer is the node-engine build each machine runs, its entry read through `entry`, or the revision's where it differs from the
// trunk's, or the revision's for a machine whose node-engine is not heard running (A-451); the run's verdict is read from its step-ended; a machine away passes with a warning, one not composing fails the step.
func TestTheCompositionStepRunsOneAskPerMachine(t *testing.T) {
step := meshwants.StepRun{Module: "m", Branch: "main", Revision: 7, Step: meshwants.StepRunStepComposition}
s := newRunStand(t, "src2:e1", "src2:e1", "d1")
out := s.r.run(context.Background(), "ask-step", step)
if out.Outcome != meshwants.StepEndedOutcomeFailed || !strings.Contains(out.Said, "g14 does not compose") || !strings.Contains(out.Said, "/etc/x") ||
strings.Contains(out.Said, "ace") || len(out.Warnings) != 2 || !strings.Contains(out.Warnings[0], "shanks is away") ||
out.Warnings[1] != "g14: the composer names no culprits" {
t.Fatalf("the step came to %+v", out)
}
if len(s.asks) != 2 {
t.Fatalf("asked %d runs, want one per machine not away", len(s.asks))
}
a, req := s.asks["ace"], s.requests["ace"]
if a.Kind != buildstep.AskCheck || a.Language != buildstep.AskGo || a.Asker != runAsker || a.Run == nil || len(a.Run.Heads) != 0 ||
a.Run.Input.Verb != "seat:mesh-wants.input" || a.Run.Program != (buildstep.RunProgram{Repository: "novox/mesh-host", Commit: commitE1, Dir: ".", Package: composer.Package}) {
t.Errorf("the run ask of ace %+v %+v", a, a.Run)
}
if s.asks["g14"].Run.Program.Commit != commitE2 {
t.Errorf("g14's composer is built at %s, want the build its node-engine runs", s.asks["g14"].Run.Program.Commit)
}
if req.Depth != composer.DepthCompose || req.BlameTries != 20 || len(req.Machines) != 1 || req.Machines[0] != "ace" || len(req.Cases) != 1 || req.Cases[0].Name != changeCase ||
string(req.Input) != `{"node":"ace"}` || len(req.Seats) != 1 || string(req.Seats[0]) != `{"seat":"s1"}` {
t.Errorf("the request of ace %+v", req)
}
c := req.Cases[0]
if string(c.Manifests["m"].Raw) != `{"module":"m"}` || len(c.Manifests) != 4 || len(c.None) != 1 || c.None["lidarr"] != "builders disagree: node" || len(c.Verdicts) != 1 || !strings.Contains(string(c.Verdicts["bad"]), `"refused"`) ||
!strings.Contains(string(c.Verdicts["bad"]), "no seat x") {
t.Errorf("the case %+v %s", c.Manifests, c.Verdicts)
}
if strings.Join(s.entries, " ") == "" {
t.Error("no node-engine entry is read through entry")
}
// The revision's node-engine differs from the trunk's: that build composes every machine, and no entry is asked.
changed := newRunStand(t, "src2:e3", "src2:e1", "d1")
if out := changed.r.run(context.Background(), "ask-step", step); out.Outcome != meshwants.StepEndedOutcomeFailed {
t.Fatalf("the step came to %+v", out)
}
if changed.asks["ace"].Run.Program.Commit != commitE3 || changed.asks["g14"].Run.Program.Commit != commitE3 || len(changed.entries) != 0 {
t.Errorf("the change's node-engine does not compose every machine: %+v %+v %v", changed.asks["ace"].Run.Program, changed.asks["g14"].Run.Program, changed.entries)
}
// No running of the node-engine is heard on g14: its composer is the revision's entry, and no entry is asked for it (A-451).
unheard := newRunStand(t, "src2:e1", "src2:e1", "d1")
unheard.r.running = func(node, module string) (ne.Running, bool) {
return ne.Running{Node: node, Module: module, Fingerprint: "src2:e1"}, node == "ace" && module == "engine"
}
if out := unheard.r.run(context.Background(), "ask-step", step); out.Outcome != meshwants.StepEndedOutcomeFailed || !strings.Contains(out.Said, "g14 does not compose") {
t.Fatalf("the step with g14's node-engine not heard came to %+v", out)
}
if unheard.asks["g14"].Run == nil || unheard.asks["g14"].Run.Program.Commit != commitE1 {
t.Errorf("g14's composer with no running heard is %+v, want the revision's entry", unheard.asks["g14"].Run)
}
// A seat digest neither the revision nor the trunk holds: could not run, naming the seat and the digest (A-261).
other := newRunStand(t, "src2:e1", "src2:e1", "d2")
if out := other.r.run(context.Background(), "ask-step", step); out.Outcome != meshwants.StepEndedOutcomeCouldNotRun ||
!strings.Contains(out.Said, "s1") || !strings.Contains(out.Said, "d1") || len(other.asks) != 0 {
t.Errorf("a seat digest not held came to %+v, %d asks", out, len(other.asks))
}
// A revision naming no definition (A-234's stand-in): the composer is handed the trunk seat list's definitions, read through
// seat-definitions (A-467); a list that cannot be read, or names no seat, ends the step could not run, naming it, with no ask put.
bare := newRunStand(t, "src2:e1", "src2:e1", "d1")
bare.noDefinitions, bare.trunkSeats = true, []meshcatalog.SeatDefinitionsAnswerSeatsItem{{Seat: "s1", Digest: "d1"}}
if out := bare.r.run(context.Background(), "ask-step", step); out.Outcome != meshwants.StepEndedOutcomeFailed ||
len(bare.requests["ace"].Seats) != 1 || string(bare.requests["ace"].Seats[0]) != `{"seat":"s1"}` {
t.Errorf("a revision with no definitions came to %+v, seats %v", out, bare.requests["ace"].Seats)
}
for name, fault := range map[string]error{"unreadable": errors.New("no responder"), "empty": nil} {
s := newRunStand(t, "src2:e1", "src2:e1", "d1")
s.noDefinitions, s.listFault = true, fault
if out := s.r.run(context.Background(), "ask-step", step); out.Outcome != meshwants.StepEndedOutcomeCouldNotRun ||
!strings.Contains(out.Said, "seat list is not read") || len(s.asks) != 0 {
t.Errorf("the %s seat list came to %+v, %d asks", name, out, len(s.asks))
}
}
// A machine the composer did not judge is could not run, naming why: a step that judged nothing never passes (A-467).
nj := newRunStand(t, "src2:e1", "src2:e1", "d1")
nj.unjudged = "g14"
if out := nj.r.run(context.Background(), "ask-step", step); out.Outcome != meshwants.StepEndedOutcomeCouldNotRun ||
!strings.Contains(out.Said, "g14 was not judged: the composer was handed no seat list") {
t.Errorf("a machine not judged came to %+v", out)
}
// No machine judged: every machine away, or no machine, never passes; each is named with why (A-467a).
for name, machines := range map[string][]string{"every machine away": {"shanks"}, "no machine": {}} { // none placed: the inputs say so already
want := "no machine was judged"
if len(machines) == 0 {
want = "has no machine to compose"
}
none := newRunStand(t, "src2:e1", "src2:e1", "d1")
none.r.inputs.machines = func(string, string) []string { return machines }
if out := none.r.run(context.Background(), "ask-step", step); out.Outcome != meshwants.StepEndedOutcomeCouldNotRun ||
!strings.Contains(out.Said, want) || (len(machines) > 0 && !strings.Contains(out.Said, "shanks is away")) || len(none.asks) != 0 {
t.Errorf("%s came to %+v, %d asks", name, out, len(none.asks))
}
}
// At the inputs state's cap the ask is refused, naming the store (§354).
full := newRunStand(t, "src2:e1", "src2:e1", "d1")
full.r.keeper.used = func() (int64, error) { return inputsCap, nil }
if out := full.r.run(context.Background(), "ask-step", step); out.Outcome != meshwants.StepEndedOutcomeCouldNotRun ||
!strings.Contains(out.Said, "the state inputs is at its cap") || len(full.asks) != 0 {
t.Errorf("an ask at the cap came to %+v, %d asks", out, len(full.asks))
}
}
// Design 47 G §354, A-252: the entries of one catalog revision are read once for every step of it, and a read that times out is
// made again with a growing wait for a bounded time, said in the journal, before the step could not run.
func TestTheCompositionStepReadsTheRevisionOnceAndAgainOnATimeout(t *testing.T) {
step := meshwants.StepRun{Module: "m", Branch: "main", Revision: 7, Step: meshwants.StepRunStepComposition}
for _, tc := range []struct {
name string
faults int // consecutive faults of the `revision` read before it answers
fault error // the fault
steps int
want string // the outcome of the last step
revisionCalls int
waits int
}{
{"two steps of one revision read it once", 0, nil, 2, meshwants.StepEndedOutcomeFailed, 2, 0},
{"a timeout is read again", 3, errors.New("context deadline exceeded"), 1, meshwants.StepEndedOutcomeFailed, 5, 3},
{"a fault that stays ends could not run", 1000, errors.New("nats: timeout"), 1, meshwants.StepEndedOutcomeCouldNotRun, -1, -1},
{"a fault of the answer is not read again", 1, errors.New("no such revision"), 1, meshwants.StepEndedOutcomeCouldNotRun, 1, 0},
} {
t.Run(tc.name, func(t *testing.T) {
s := newRunStand(t, "src2:e1", "src2:e1", "d1")
inner := s.r.call
var mu sync.Mutex
calls, faults := 0, tc.faults
s.r.call = func(key string, body any) (json.RawMessage, error) {
if key == mcc.RevisionVerb {
mu.Lock()
calls++
f := faults > 0
faults--
mu.Unlock()
if f {
return nil, tc.fault
}
}
return inner(key, body)
}
clock := time.Unix(1000, 0)
var waits []time.Duration
s.r.now = func() time.Time { mu.Lock(); defer mu.Unlock(); return clock }
s.r.sleep = func(_ context.Context, d time.Duration) error {
mu.Lock()
defer mu.Unlock()
waits = append(waits, d)
clock = clock.Add(d)
return nil
}
var wg sync.WaitGroup
outs := make([]stepOutcome, tc.steps)
for i := range outs {
wg.Add(1)
go func() { defer wg.Done(); outs[i] = s.r.run(context.Background(), "ask-step", step) }()
}
wg.Wait()
for _, o := range outs {
if o.Outcome != tc.want {
t.Fatalf("a step came to %+v, want %s", o, tc.want)
}
}
if tc.waits == -1 { // never answers: bounded, growing waits
if len(waits) < 3 || waits[0] != readsFirstWait || waits[1] != 2*readsFirstWait || waits[len(waits)-1] != readsMaxWait {
t.Errorf("the waits %v do not grow to %s", waits, readsMaxWait)
}
var total time.Duration
for _, w := range waits {
total += w
}
if total > readsBound {
t.Errorf("read again for %s, bound %s", total, readsBound)
}
if !strings.Contains(outs[0].Said, "catalog revision is not read") || !strings.Contains(outs[0].Said, "timeout") {
t.Errorf("the step said %q", outs[0].Said)
}
return
}
if calls != tc.revisionCalls || len(waits) != tc.waits {
t.Errorf("`revision` asked %d times with %d waits, want %d and %d", calls, len(waits), tc.revisionCalls, tc.waits)
}
})
}
}
// Design 47 G §718, §719, §720: three composition steps of one revision on two machines start two runs, one request and one run
// ask per machine, and each step reads both verdicts; the run records its program with the node-engine fingerprint it was chosen
// from and the digest of its kept request, which names no module of the asking pipeline; a step of another candidate starts its
// own runs, and a run that could not run is never read again.
func TestTheStepsOfOneCandidateReadOneRunPerMachine(t *testing.T) {
s := newRunStand(t, "src2:e1", "src2:e1", "d1")
s.r.inputs.machines = func(string, string) []string { return []string{"ace", "g14"} }
var wg sync.WaitGroup
outs := make([]stepOutcome, 3)
for i, m := range []string{"m", "m2", "m3"} {
wg.Add(1)
go func() {
defer wg.Done()
outs[i] = s.r.run(context.Background(), "ask-"+m, meshwants.StepRun{Pipeline: "main.7." + m, Module: m, Branch: "main", Revision: 7, Step: meshwants.StepRunStepComposition})
}()
}
wg.Wait()
for i, o := range outs {
if len(o.Shared) != 2 || o.Shared[0].Machine != "ace" || o.Shared[0].Run != runKeyOf("main.7", "ace") || o.Shared[0].Ask == "" ||
o.Shared[1].Machine != "g14" || o.Shared[1].Ask == o.Shared[0].Ask { // §723, §729: per machine the run read and its ask
t.Errorf("step %d names the runs %+v", i, o.Shared)
}
if o.Outcome != meshwants.StepEndedOutcomeFailed || !strings.Contains(o.Said, "g14 does not compose") {
t.Errorf("step %d came to %+v, want both machines read", i, o)
}
}
if s.puts != 2 {
t.Fatalf("%d run asks put, want one per machine", s.puts)
}
ace, _, _, _ := s.runs.read(runKeyOf("main.7", "ace"))
g14, _, _, _ := s.runs.read(runKeyOf("main.7", "g14"))
if len(ace.Readers) != 3 || len(g14.Readers) != 3 || ace.Program == nil || ace.Program.Fingerprint != "src2:e1" || ace.Program.Commit != commitE1 ||
g14.Program == nil || g14.Program.Fingerprint != "src2:e2" || ace.Input == "" || ace.Input != digestOf(mustJSON(t, s.requests["ace"])) ||
ace.Outcome != meshwants.CompositionRunOutcomePassed || g14.Outcome != meshwants.CompositionRunOutcomePassed || g14.Verdict["composes"] != false {
t.Errorf("the runs: ace %+v, g14 %+v", ace, g14)
}
if req := s.requests["ace"]; strings.Contains(string(mustJSON(t, req)), "main.7.m") || string(req.Input) != `{"node":"ace"}` {
t.Errorf("the request names the asking pipeline or not the node's input: %s", mustJSON(t, req))
}
// Another candidate (a run on request) starts its own runs.
if o := s.r.run(context.Background(), "ask-r", meshwants.StepRun{Pipeline: "run-r1.m", Module: "m", Branch: "main", Revision: 7, Run: "r1", Step: meshwants.StepRunStepComposition}); o.Outcome != meshwants.StepEndedOutcomeFailed || s.puts != 4 {
t.Errorf("a step of another candidate came to %+v with %d asks, want its own two runs", o, s.puts)
}
// A run whose ask could not be put could not run; the next step of the candidate starts it again.
f := newRunStand(t, "src2:e1", "src2:e1", "d1")
f.r.inputs.machines = func(string, string) []string { return []string{"ace"} }
put, refused := f.r.put, 0
f.r.put = func(ctx context.Context, a buildstep.StepAsk) error {
if refused == 0 {
refused++
return errors.New("no stream")
}
return put(ctx, a)
}
first := f.r.run(context.Background(), "ask-1", meshwants.StepRun{Pipeline: "main.7.m", Module: "m", Branch: "main", Revision: 7, Step: meshwants.StepRunStepComposition})
second := f.r.run(context.Background(), "ask-2", meshwants.StepRun{Pipeline: "main.7.m2", Module: "m2", Branch: "main", Revision: 7, Step: meshwants.StepRunStepComposition})
if first.Outcome != meshwants.StepEndedOutcomeCouldNotRun || !strings.Contains(first.Said, "is not put") || second.Outcome != meshwants.StepEndedOutcomePassed || f.puts != 1 {
t.Errorf("after a run that could not run: %+v then %+v, %d asks", first, second, f.puts)
}
}
func mustJSON(t *testing.T, v any) []byte {
t.Helper()
raw, err := json.Marshal(v)
if err != nil {
t.Fatal(err)
}
return raw
}
// Design 47 G §721, §722, A-470b: a step judges each machine from its verdict's `blamed`: a verdict blaming the step's module fails
// it and passes another module's step with a warning naming the module; a machine that does not compose and blames no module fails
// every step; a verdict with no `blamed` is judged as before and says "the composer names no culprits"; a module the search did not
// try is could not run for its own step; a run that could not run is could not run.
func TestAMachineIsJudgedByTheModulesItBlames(t *testing.T) {
at := time.Now()
runOf := func(verdict string) meshwants.CompositionRun {
var v map[string]any
if err := json.Unmarshal([]byte(verdict), &v); err != nil {
t.Fatal(err)
}
return meshwants.CompositionRun{Candidate: "main.7", Machine: "ace", Ended: &at, Outcome: meshwants.CompositionRunOutcomePassed, Verdict: v}
}
blamesA := `{"composes":false,"reason":"two modules own one path","blamed":[{"module":"a","problem":"/etc/x is a's and c's"}]}`
for _, tc := range []struct {
name, module string
run meshwants.CompositionRun
failed, couldNo string
warnings []string
}{
{"blamed module fails", "a", runOf(blamesA), "ace holds a: /etc/x is a's and c's", "", nil},
{"another module passes with a warning", "b", runOf(blamesA), "", "", []string{"ace holds a: /etc/x is a's and c's"}},
{"blames no module fails both", "b", runOf(`{"composes":false,"reason":"the node's own composition","blamed":[]}`), "ace does not compose and blames no module: the node's own composition", "", nil},
{"an old composer", "b", runOf(`{"composes":false,"reason":"x"}`), "ace does not compose: x", "", []string{"ace: the composer names no culprits"}},
{"composes", "b", runOf(`{"composes":true,"blamed":[]}`), "", "", nil},
{"own module not tried", "a", runOf(`{"composes":false,"blamed":[{"module":"a","problem":"not tried: the search reached its bound"}]}`), "",
"ace holds a untried: the composer's search for culprits reached its bound of blame_tries (A-470b)", nil},
{"another not tried", "b", runOf(`{"composes":false,"blamed":[{"module":"a","problem":"not tried: the search reached its bound"}]}`), "", "",
[]string{"ace holds a: not tried: the search reached its bound"}},
{"not judged", "a", runOf(`{"composes":false,"not_judged":"no seat list","blamed":[]}`), "", "ace was not judged: no seat list", nil},
{"could not run", "a", meshwants.CompositionRun{Machine: "ace", Ended: &at, Outcome: meshwants.CompositionRunOutcomeCouldNotRun, Said: "ace: gone"}, "", "ace: gone", nil},
} {
t.Run(tc.name, func(t *testing.T) {
e := judgeRun(tc.module, tc.run)
if e.failed != tc.failed || e.couldNot != tc.couldNo || !slices.Equal(e.warnings, tc.warnings) {
t.Errorf("judged %+v, want failed %q, could not run %q, warnings %q", e, tc.failed, tc.couldNo, tc.warnings)
}
})
}
}
// Design 47 G §727, A-468g, A-470d: a rerun of a composition step starts a new run only on the machine it did not pass, replacing
// that key and carrying every former reader, the one that did not pass marked rerun with the rerun's caller; at the new run's end
// that reader says its end again, marked rerun, naming the new run's ask; a reader that passed does not move; the machine the
// step passed keeps its verdict.
func TestARerunMovesEveryReaderThatDidNotPass(t *testing.T) {
s := newRunStand(t, "src2:e1", "src2:e1", "d1")
s.r.inputs.machines = func(string, string) []string { return []string{"ace", "g14"} }
var mu sync.Mutex
fixed := false
s.verdict = func(node string) (composer.Machine, bool) {
mu.Lock()
defer mu.Unlock()
m := composer.Machine{Composes: true}
m.Blamed = []struct {
Module string `json:"module"`
Problem string `json:"problem"`
}{}
if node == "g14" && !fixed {
m.Composes, m.Reason = false, "two modules own one path"
m.Blamed = append(m.Blamed, struct {
Module string `json:"module"`
Problem string `json:"problem"`
}{"a", "/etc/x"}, struct {
Module string `json:"module"`
Problem string `json:"problem"`
}{"d", "/etc/x"})
}
return m, true
}
ends := make(chan meshwants.StepEnded, 16)
msgIDs := map[string]string{} // the message id of each step's latest end
steps := &compositionSteps{node: "n1", now: time.Now, logf: t.Logf, run: s.r.run, resume: s.r.resume, ended: s.runs.stepEnded,
say: func(event string, body any, msgID string) error {
if e, ok := body.(meshwants.StepEnded); ok {
mu.Lock()
msgIDs[e.ID] = msgID
mu.Unlock()
ends <- e
}
return nil
}}
move := steps.move(context.Background())
s.runs.moved.Store(&move)
step := func(m string, rerun bool) []byte {
raw, _ := json.Marshal(meshwants.StepRun{Pipeline: "main.7." + m, Module: m, Branch: "main", Revision: 7, Step: meshwants.StepRunStepComposition, Rerun: rerun, By: map[bool]string{true: "op@n1"}[rerun]})
return raw
}
got := map[string]meshwants.StepEnded{}
for _, m := range []string{"a", "b", "d"} {
steps.take(context.Background(), "ask-"+m, step(m, false))
e := <-ends
got[e.Module] = e
}
if got["a"].Outcome != meshwants.StepEndedOutcomeFailed || got["d"].Outcome != meshwants.StepEndedOutcomeFailed || got["b"].Outcome != meshwants.StepEndedOutcomePassed {
t.Fatalf("the first ends: %+v", got)
}
former := got["d"].Shared[1].Ask
mu.Lock()
fixed = true
mu.Unlock()
steps.take(context.Background(), "ask-a2", step("a", true))
moved := map[string]meshwants.StepEnded{}
for range 2 {
select {
case e := <-ends:
moved[e.ID] = e
case <-time.After(5 * time.Second):
t.Fatalf("the ends after the rerun: %+v", moved)
}
}
a, d := moved["ask-a2"], moved["ask-d"]
if a.Outcome != meshwants.StepEndedOutcomePassed || d.Outcome != meshwants.StepEndedOutcomePassed || !d.Rerun || d.By != "op@n1" ||
len(d.Shared) != 2 || d.Shared[1].Machine != "g14" || d.Shared[1].Ask == former || d.Shared[1].Ask != a.Shared[1].Ask {
t.Fatalf("after the rerun: a %+v, d %+v", a, d)
}
mu.Lock()
// A-470q: the first end keeps the ask's id; the end said again names the moved run's ask, so the bus does not drop it.
if msgIDs["ask-a2"] != "ask-a2" || msgIDs["ask-d"] != "ask-d."+a.Shared[1].Ask || msgIDs["ask-b"] != "ask-b" {
t.Errorf("the message ids of the ends: %v", msgIDs)
}
mu.Unlock()
if s.puts != 3 {
t.Errorf("%d run asks, want one more for the machine a did not pass", s.puts)
}
select {
case e := <-ends:
t.Errorf("a reader that passed moved: %+v", e)
case <-time.After(50 * time.Millisecond):
}
run, _, _, _ := s.runs.read(runKeyOf("main.7", "g14"))
marks := map[string]bool{}
for _, c := range run.Readers {
marks[c.ID] = c.Rerun
}
if len(run.Readers) != 3 || !marks["ask-d"] || marks["ask-b"] || !marks["ask-a2"] {
t.Errorf("the new run's readers %+v", run.Readers)
}
// A-470m: each reader's `ended` is written once its step said its end, and ask-b's carried into the new run.
deadline := time.After(5 * time.Second)
for {
wake := s.runs.wake()
run, _, _, _ = s.runs.read(runKeyOf("main.7", "g14"))
if !slices.ContainsFunc(run.Readers, func(c meshwants.CompositionReader) bool { return c.Ended == nil }) {
break
}
select {
case <-wake:
case <-deadline:
t.Fatalf("a reader of the new run names no end: %+v", run.Readers)
}
}
}
@@ -0,0 +1,896 @@
package main
import (
"context"
"encoding/json"
"errors"
"fmt"
"io/fs"
"os"
"slices"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/nats-io/nats.go/jetstream"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
"git.novox.be/novox/mesh-sdk/go/keys"
"mesh-delivery-assigner/internal/buckets"
)
// The composition runs (design 47 G §718, §719; A-468, A-469d, A-469w, A-469x): the assigner composes each machine once per
// candidate, whatever number of composition steps name it. Each run is one key of its old state `composition-runs`,
// `<candidate key>.<machine>`, each part escaped as a key's name; the step that starts a run writes the key create-only,
// so two steps of one candidate starting at once start one run and the second reads it. A reader is the composition step's
// StepRun with its ask's id (A-468), added and removed by compare-and-set. A key is deleted once composition-runs-kept has
// passed since its `ended`, judged at each new run over at most 20 of the oldest ended keys, as the state inputs is
// (A-465b, A-468b); at the cap (composition-runs-cap-mib, the manifest's max-mib its ceiling, A-469d) no run is started.
const (
// runsSwept is how many of the oldest ended keys each new run judges.
runsSwept = 20
// runBoundPrefix and runUntakenPrefix open a run's two bound keys, each with its own time to live (§720, A-468b,
// A-470): `bound.<run key>` from the ask's ask-taken, `untaken.<run key>` from the run's start.
runBoundPrefix = "bound."
runUntakenPrefix = "untaken."
)
// runKeyOf is the key of a candidate's composition run of a machine (§719).
func runKeyOf(candidate, machine string) string {
return keysPart(candidate) + "." + keys.EscapeName(machine)
}
// keysPart is a name as a key's part.
func keysPart(name string) string { return keys.EscapeName(name) }
// isRunKey is whether a key of the state is a run's own, not one of its bound keys.
func isRunKey(key string) bool {
return !strings.HasPrefix(key, runBoundPrefix) && !strings.HasPrefix(key, runUntakenPrefix)
}
// runSettings are the settings of the composition runs, each read at the start from the file the manifest declares.
type runSettings struct {
// capBytes is composition-runs-cap-mib in bytes.
capBytes int64
// kept is composition-runs-kept, stepBound composition-step-bound, untaken run-untaken-bound (A-469x).
kept, stepBound, untaken time.Duration
// blameTries is blame-tries, carried in each run's request (§721).
blameTries int
}
// defaultRunSettings are the settings' defaults, as the manifest gives them.
var defaultRunSettings = runSettings{capBytes: 16 << 20, kept: 24 * time.Hour, stepBound: 30 * time.Minute, untaken: 24 * time.Hour, blameTries: 20}
// runSettingsOf reads the settings composition-runs-cap-mib, composition-runs-kept, composition-step-bound,
// run-untaken-bound and blame-tries from the files the environment names (A-469x, as outsideSettings): a missing or empty
// file is its default; a content that is no positive whole number or Go duration is an error naming the file.
func runSettingsOf(getenv func(string) string) (runSettings, error) {
s := defaultRunSettings
mib, err := settingFile(getenv("MESH_ASSIGNER_COMPOSITION_RUNS_CAP_MIB_FILE"))
if err != nil {
return s, err
}
if mib > 0 {
s.capBytes = int64(mib) << 20
}
tries, err := settingFile(getenv("MESH_ASSIGNER_BLAME_TRIES_FILE"))
if err != nil {
return s, err
}
if tries > 0 {
s.blameTries = tries
}
for env, to := range map[string]*time.Duration{"MESH_ASSIGNER_COMPOSITION_RUNS_KEPT_FILE": &s.kept,
"MESH_ASSIGNER_COMPOSITION_STEP_BOUND_FILE": &s.stepBound, "MESH_ASSIGNER_RUN_UNTAKEN_BOUND_FILE": &s.untaken} {
d, err := durationFile(getenv(env))
if err != nil {
return s, err
}
if d > 0 {
*to = d
}
}
return s, nil
}
// durationFile reads one setting's file holding a Go duration: 0 for no path, no file or an empty one.
func durationFile(path string) (time.Duration, error) {
if path == "" {
return 0, nil
}
raw, err := os.ReadFile(path)
if errors.Is(err, fs.ErrNotExist) {
return 0, nil
}
if err != nil {
return 0, err
}
v := strings.TrimSpace(string(raw))
if v == "" {
return 0, nil
}
d, err := time.ParseDuration(v)
if err != nil || d <= 0 {
return 0, fmt.Errorf("%s holds %q, which is not a positive Go duration such as 30m", path, v)
}
return d, nil
}
// errRunChanged is a compare-and-set of a run's key that met another write.
var errRunChanged = errors.New("the composition run's key changed")
// runsKV is the state composition-runs: the bus bucket, or a test's.
type runsKV interface {
// get is a key's value and revision; nil for a key not there.
get(key string) ([]byte, uint64, error)
// create writes a key that does not stand, update one at its revision: errRunChanged when it does not stand so.
create(key string, value []byte) (uint64, error)
update(key string, value []byte, revision uint64) (uint64, error)
// delAt deletes a key at its revision: errRunChanged when it no longer stands so, nothing for a key not there. No write
// of the state is made from a value read before its latest change.
delAt(key string, revision uint64) error
keys() ([]string, error)
// arm writes a bound key afresh holding the ask of the run it bounds, with its own time to live (§720, A-470n): at the key's
// latest revision, a delete marker counted, read again when another write came between; its expiry is the bus's event. It
// answers the revision written.
arm(key, ask string, ttl time.Duration) (uint64, error)
// used is how many bytes the state holds.
used() (int64, error)
}
// busRuns is runsKV over the bus bucket.
type busRuns struct {
ctx context.Context
js jetstream.JetStream
kv jetstream.KeyValue
}
func (b busRuns) get(key string) ([]byte, uint64, error) {
e, err := b.kv.Get(b.ctx, key)
if errors.Is(err, jetstream.ErrKeyNotFound) {
return nil, 0, nil
}
if err != nil {
return nil, 0, err
}
return e.Value(), e.Revision(), nil
}
func (b busRuns) create(key string, value []byte) (uint64, error) {
rev, err := b.kv.Create(b.ctx, key, value)
if errors.Is(err, jetstream.ErrKeyExists) {
return 0, errRunChanged
}
return rev, err
}
func (b busRuns) update(key string, value []byte, revision uint64) (uint64, error) {
rev, err := b.kv.Update(b.ctx, key, value, revision)
if errors.Is(err, jetstream.ErrKeyExists) || errors.Is(err, jetstream.ErrKeyRevisionMismatch) {
return 0, errRunChanged
}
return rev, err
}
func (b busRuns) delAt(key string, revision uint64) error {
err := b.kv.Delete(b.ctx, key, jetstream.LastRevision(revision))
if errors.Is(err, jetstream.ErrKeyExists) || errors.Is(err, jetstream.ErrKeyRevisionMismatch) {
return errRunChanged
}
return err
}
func (b busRuns) keys() ([]string, error) {
l, err := b.kv.ListKeys(b.ctx)
if err != nil {
return nil, err
}
var out []string
for k := range l.Keys() {
out = append(out, k)
}
return out, nil
}
// boundValue is a bound key's value: the key and the ask of the run it bounds (A-470n).
type boundValue struct {
Bound string `json:"bound"`
Ask string `json:"ask"`
}
// arm publishes the bound key holding ask with ttl as its own time to live, expecting the key's latest message (a delete
// marker counted), so a write between is read again and never overwritten unseen (A-470n); the earlier message, replaced,
// takes its time to live with it, so the expiry is heard only ttl after the last write.
func (b busRuns) arm(key, ask string, ttl time.Duration) (uint64, error) {
if b.js == nil {
return 0, errors.New("no bus to arm a bound on")
}
raw, err := json.Marshal(boundValue{Bound: key, Ask: ask})
if err != nil {
return 0, err
}
subject := "$KV." + b.kv.Bucket() + "." + key
for {
st, err := b.js.Stream(b.ctx, "KV_"+b.kv.Bucket())
if err != nil {
return 0, err
}
var last uint64
m, err := st.GetLastMsgForSubject(b.ctx, subject)
switch {
case err == nil:
last = m.Sequence
case !errors.Is(err, jetstream.ErrMsgNotFound):
return 0, err
}
ack, err := b.js.Publish(b.ctx, subject, raw, jetstream.WithMsgTTL(ttl), jetstream.WithExpectLastSequencePerSubject(last))
if err != nil && strings.Contains(err.Error(), "wrong last sequence") {
continue
}
if err != nil {
return 0, err
}
return ack.Sequence, nil
}
}
func (b busRuns) used() (int64, error) {
st, err := b.kv.Status(b.ctx)
if err != nil {
return 0, err
}
return int64(st.Bytes()), nil
}
// compositionRuns keeps the composition runs in the state composition-runs.
type compositionRuns struct {
kv runsKV
set runSettings
now func() time.Time
logf func(string, ...any)
mu sync.Mutex
// changed is closed and replaced at each change of the state heard (heard): a step waiting on a run reads its key again.
changed chan struct{}
// seen are the keys the state's watch handed and has not seen deleted: a listing of the bucket misses a key that is
// being written at that moment, so every lookup takes these beside it (keys).
seen map[string]bool
// say says an event of the seat mesh-wants (a reader's wait, A-469y); drop asks the build seat's drop of a run ask (§119);
// nil says or drops nothing.
say publisher
drop func(ask, why string) error
// moved is told each run that ended, for the readers a rerun carried to say their end again (compositionSteps.move).
// Set once the steps are served, after the hub starts.
moved atomic.Pointer[func(run meshwants.CompositionRun)]
}
func newCompositionRuns(kv runsKV, set runSettings, now func() time.Time, logf func(string, ...any)) *compositionRuns {
return &compositionRuns{kv: kv, set: set, now: now, logf: logf, changed: make(chan struct{})}
}
// heard takes a change of the state from its watch (a module watches its own state, principle 1).
func (r *compositionRuns) heard() {
r.mu.Lock()
close(r.changed)
r.changed = make(chan struct{})
r.mu.Unlock()
}
// saw keeps a key the state's watch handed: standing, or deleted or expired.
func (r *compositionRuns) saw(key string, standing bool) {
r.mu.Lock()
defer r.mu.Unlock()
if r.seen == nil {
r.seen = map[string]bool{}
}
if standing {
r.seen[key] = true
} else {
delete(r.seen, key)
}
}
// keys are the state's keys: the bucket's listing with the keys its watch handed beside it, sorted. A key read gone later
// is skipped by its reader.
func (r *compositionRuns) keys() ([]string, error) {
all, err := r.kv.keys()
if err != nil {
return nil, err
}
r.mu.Lock()
for key := range r.seen {
all = append(all, key)
}
r.mu.Unlock()
slices.Sort(all)
return slices.Compact(all), nil
}
// wake is closed at the next change heard.
func (r *compositionRuns) wake() <-chan struct{} {
r.mu.Lock()
defer r.mu.Unlock()
return r.changed
}
// read is a run's value and revision, or false.
func (r *compositionRuns) read(key string) (meshwants.CompositionRun, uint64, bool, error) {
raw, rev, err := r.kv.get(key)
if err != nil || raw == nil {
return meshwants.CompositionRun{}, 0, false, err
}
var run meshwants.CompositionRun
if err := json.Unmarshal(raw, &run); err != nil {
return meshwants.CompositionRun{}, 0, false, fmt.Errorf("the composition run %s does not read: %w", key, err)
}
return run, rev, true, nil
}
// change writes a run's key by compare-and-set: f changes the value read and says whether to write it; false leaves it.
// It answers the value written or left, and false for a key not there.
func (r *compositionRuns) change(key string, f func(*meshwants.CompositionRun) bool) (meshwants.CompositionRun, bool, error) {
for {
run, rev, ok, err := r.read(key)
if err != nil || !ok {
return run, ok, err
}
if !f(&run) {
return run, true, nil
}
raw, err := json.Marshal(run)
if err != nil {
return run, true, err
}
if _, err := r.kv.update(key, raw, rev); errors.Is(err, errRunChanged) {
continue
} else if err != nil {
return run, true, err
}
r.heard()
return run, true, nil
}
}
// fill is the state's fill against its cap.
func (r *compositionRuns) fill() (meshwants.Fill, error) {
at := r.now().UTC()
used, err := r.kv.used()
return meshwants.Fill{Store: buckets.CompositionRunsState, Bytes: used, Cap: r.set.capBytes, At: &at}, err
}
// joined is a reader's place in a run: the run's key, whether this reader started it (so it composes the machine), and the
// value as it stood.
type joined struct {
key string
started bool
run meshwants.CompositionRun
}
// join finds or starts the candidate's run of the machine for reader (§718, §719, §720): a run that stands and has not
// ended, or that ended other than could not run, is read, the reader added; none, or one that could not run, is started:
// written create-only (or replacing the ended key by compare-and-set), the reader its first, ask its run ask's id. At the
// cap no run is started, an error naming the fill.
func (r *compositionRuns) join(reader meshwants.CompositionReader, candidate, machine, ask string) (joined, error) {
key := runKeyOf(candidate, machine)
for {
run, rev, ok, err := r.read(key)
if err != nil {
return joined{}, err
}
if ok && (run.Ended == nil || run.Outcome != meshwants.CompositionRunOutcomeCouldNotRun) {
if hasReader(run.Readers, reader.ID) {
return joined{key: key, run: run}, nil
}
run.Readers = append(run.Readers, reader)
raw, err := json.Marshal(run)
if err != nil {
return joined{}, err
}
if _, err := r.kv.update(key, raw, rev); errors.Is(err, errRunChanged) {
continue
} else if err != nil {
return joined{}, err
}
r.heard()
if run.Ended == nil && r.untaken(key, run.Ask) {
r.sayWaits(run, []meshwants.CompositionReader{reader}, "")
}
return joined{key: key, run: run}, nil
}
if err := r.room(); err != nil {
return joined{}, err
}
started := r.now().UTC()
fresh := meshwants.CompositionRun{Candidate: candidate, Machine: machine, Ask: ask, Started: &started,
Readers: []meshwants.CompositionReader{reader}}
raw, err := json.Marshal(fresh)
if err != nil {
return joined{}, err
}
if ok {
_, err = r.kv.update(key, raw, rev) // could not run is never read: a new run replaces it (§720)
} else {
_, err = r.kv.create(key, raw)
}
if errors.Is(err, errRunChanged) {
continue
} else if err != nil {
return joined{}, err
}
r.heard()
// An ask waiting in the queue has no clock but run-untaken-bound from its start (A-466s, A-468b, A-470, A-470n).
if _, err := r.armBound(runUntakenPrefix, key, ask, r.set.untaken); err != nil {
r.logf("the untaken bound of the composition run %s is not armed: %v", key, err)
}
r.sayWaits(fresh, fresh.Readers, "")
return joined{key: key, started: true, run: fresh}, nil
}
}
// room sweeps the state and says whether a new run may start: an error naming the fill at the cap (as A-465a).
func (r *compositionRuns) room() error {
if err := r.sweep(); err != nil {
r.logf("composition-runs: the keys past composition-runs-kept are not all deleted: %v", err)
}
f, err := r.fill()
if err != nil {
return fmt.Errorf("the fill of the state %s is not read, so no composition run is started: %w", buckets.CompositionRunsState, err)
}
if f.Bytes >= f.Cap {
return fmt.Errorf("the state %s is at its cap of %d MiB (%d bytes kept), so no composition run is started", buckets.CompositionRunsState,
f.Cap>>20, f.Bytes)
}
return nil
}
// sweep deletes, among the 20 oldest ended runs, those ended more than composition-runs-kept ago, with their bound keys.
func (r *compositionRuns) sweep() error {
all, err := r.keys()
if err != nil {
return err
}
type endedAt struct {
key string
at time.Time
}
var ended []endedAt
for _, key := range all {
if !isRunKey(key) {
continue
}
run, _, ok, err := r.read(key)
if err != nil || !ok || run.Ended == nil {
continue
}
ended = append(ended, endedAt{key, *run.Ended})
}
slices.SortFunc(ended, func(a, b endedAt) int { return a.at.Compare(b.at) })
if len(ended) > runsSwept {
ended = ended[:runsSwept]
}
var errs []error
for _, e := range ended {
if r.now().Sub(e.at) >= r.set.kept {
errs = append(errs, r.deleteRun(e.key, func(run meshwants.CompositionRun) bool {
return run.Ended != nil && r.now().Sub(*run.Ended) >= r.set.kept
}))
}
}
return errors.Join(errs...)
}
// deleteRun deletes a run's key with its bound keys while the value it holds is still one gone judges gone, each delete at the
// revision just read and judged again on a conflict: a run that replaced the key meanwhile, and its bounds, stand.
func (r *compositionRuns) deleteRun(key string, gone func(meshwants.CompositionRun) bool) error {
for {
run, rev, ok, err := r.read(key)
if err != nil || !ok || !gone(run) {
return err
}
if err := r.clearBounds(key, run.Ask, runBoundPrefix, runUntakenPrefix); err != nil {
return err
}
if err := r.kv.delAt(key, rev); errors.Is(err, errRunChanged) {
continue
} else if err != nil {
return err
}
r.heard()
return nil
}
}
// clearBounds deletes the bound keys of the run of ask while key holds that run (or none) and the bound holds that ask: each at
// the revision it was read at, read again on a conflict, so a bound a newer run of the key armed is never deleted.
func (r *compositionRuns) clearBounds(key, ask string, prefixes ...string) error {
var errs []error
for _, prefix := range prefixes {
for {
run, _, ok, err := r.read(key)
if err != nil {
errs = append(errs, err)
break
}
if ok && run.Ask != ask {
break // a newer run holds the key: its bounds are its own
}
held, rev, standing, err := r.boundOf(prefix + key)
if err != nil || !standing {
errs = append(errs, err)
break
}
if held != ask {
break // the bound of another ask (A-470n): not this run's to delete
}
if err := r.kv.delAt(prefix+key, rev); errors.Is(err, errRunChanged) {
continue
} else if err != nil {
errs = append(errs, err)
}
break
}
}
return errors.Join(errs...)
}
// stepEnded writes at as the `ended` of the reader asked under id in each run of its step's candidate naming it, by
// compare-and-set (A-470m): the time its step said its end, carried with it into a rerun's run.
func (r *compositionRuns) stepEnded(id string, step meshwants.StepRun, at time.Time) {
candidate, err := candidateKeyOf(step)
if err != nil {
r.logf("the end of the composition step %s is not written on its runs: %v", id, err)
return
}
keys, err := r.keysOf(candidate, id)
if err != nil {
r.logf("the end of the composition step %s is not written on its runs: %v", id, err)
return
}
at = at.UTC()
for _, key := range keys {
if _, _, err := r.change(key, func(c *meshwants.CompositionRun) bool {
i := slices.IndexFunc(c.Readers, func(c meshwants.CompositionReader) bool { return c.ID == id })
if i < 0 {
return false
}
c.Readers[i].Ended = &at
return true
}); err != nil {
r.logf("the end of the composition step %s is not written on the composition run %s: %v", id, key, err)
}
}
}
// hasReader is whether readers holds the step asked under id.
func hasReader(readers []meshwants.CompositionReader, id string) bool {
return slices.ContainsFunc(readers, func(c meshwants.CompositionReader) bool { return c.ID == id })
}
// readerOf is a composition step as a run's reader: its StepRun with its ask's id (A-468).
func readerOf(id string, s meshwants.StepRun) meshwants.CompositionReader {
return meshwants.CompositionReader{ID: id, Pipeline: s.Pipeline, Step: s.Step, Module: s.Module, Branch: s.Branch, Commit: s.Commit,
Revision: s.Revision, Source: s.Source, Fingerprint: s.Fingerprint, Run: s.Run, Rerun: s.Rerun, By: s.By}
}
// stepRunOf is a reader's StepRun again, for its step-ended.
func stepRunOf(c meshwants.CompositionReader) meshwants.StepRun {
return meshwants.StepRun{Pipeline: c.Pipeline, Step: c.Step, Module: c.Module, Branch: c.Branch, Commit: c.Commit, Revision: c.Revision,
Source: c.Source, Fingerprint: c.Fingerprint, Run: c.Run, Rerun: c.Rerun, By: c.By}
}
// watchRuns hears the changes of the state composition-runs (principle 1): each change wakes the steps waiting on a run, and
// the expiry of a bound key, the bus's marker, is handed to expired (§720). After the values that stand, ready is called.
func watchRuns(ctx context.Context, kv jetstream.KeyValue, r *compositionRuns, expired func(key string), ready func()) error {
w, err := kv.WatchAll(ctx)
if err != nil {
return err
}
go func() {
defer func() { _ = w.Stop() }()
for {
select {
case <-ctx.Done():
return
case e, ok := <-w.Updates():
if !ok {
return
}
if e == nil {
if ready != nil {
ready()
ready = nil
}
continue
}
r.saw(e.Key(), e.Operation() == jetstream.KeyValuePut)
if e.Operation() == jetstream.KeyValuePurge && !isRunKey(e.Key()) && expired != nil {
expired(e.Key())
}
r.heard()
}
}
}()
return nil
}
// end ends the run of ask in its key with an outcome, its words and the machine's verdict, by compare-and-set; it answers
// false when the key holds another run or the run has ended already.
func (r *compositionRuns) end(key, ask, outcome, said string, verdict map[string]any) (bool, error) {
ended := false
_, _, err := r.change(key, func(c *meshwants.CompositionRun) bool {
if c.Ask != ask || c.Ended != nil {
return false
}
at := r.now().UTC()
c.Ended, c.Outcome, c.Said, c.Verdict = &at, outcome, said, verdict
ended = true
return true
})
return ended, err
}
// keyOfAsk is the key of the run whose ask is ask, or none.
func (r *compositionRuns) keyOfAsk(ask string) (string, meshwants.CompositionRun, error) {
all, err := r.keys()
if err != nil {
return "", meshwants.CompositionRun{}, err
}
for _, key := range all {
if !isRunKey(key) {
continue
}
run, _, ok, err := r.read(key)
if err == nil && ok && run.Ask == ask {
return key, run, nil
}
}
return "", meshwants.CompositionRun{}, nil
}
// heardEnd ends the run of the ask a build seat's step-ended names (§719, A-240): a run ask that ended other than passed
// could not run; a passed one's answer, read with read, is the machine's verdict, or why it is none. An end of an ask no run
// names is another asker's, or of a run gone, and changes nothing.
func (r *compositionRuns) heardEnd(e buildstep.StepEnded, read func(buildstep.StepEnded) ([]byte, error)) error {
if e.Asker != runAsker || e.Ask == "" {
return nil
}
key, run, err := r.keyOfAsk(e.Ask)
if err != nil || key == "" {
return err
}
if run.Ended != nil { // ended by its bound or a drop: the end heard later is ignored (§720)
r.logf("the step-ended of the run ask %s is ignored: its composition run %s ended before it (%s)", e.Ask, key, run.Said)
return nil
}
node := run.Machine
outcome, said := meshwants.CompositionRunOutcomeCouldNotRun, ""
var verdict map[string]any
if e.Outcome != buildstep.OutcomePassed {
said = fmt.Sprintf("%s: its run ask %s ended %s on %s: %s", node, e.Ask, e.Outcome, e.Node, e.Said)
} else if answer, err := read(e); err != nil { // the program's last line of standard output (A-254)
said = node + ": " + err.Error()
} else if verdict, said = runVerdict(node, answer); said == "" {
outcome = meshwants.CompositionRunOutcomePassed
}
_, err = r.endRun(key, e.Ask, outcome, said, verdict)
return err
}
// await waits until each run of keys has ended, through the state's changes heard, or ctx ends: it answers each run as it
// stands then; a key gone could not run.
func (r *compositionRuns) await(ctx context.Context, keys []string) map[string]meshwants.CompositionRun {
out := map[string]meshwants.CompositionRun{}
for {
wake := r.wake()
open := false
for _, key := range keys {
run, _, ok, err := r.read(key)
switch {
case err != nil:
open = true
continue
case !ok:
at := r.now().UTC()
candidate, machine, _ := strings.Cut(key, ".")
run = meshwants.CompositionRun{Candidate: unescape(candidate), Machine: unescape(machine), Ended: &at,
Outcome: meshwants.CompositionRunOutcomeCouldNotRun, Said: unescape(machine) + ": its composition run " + key + " is gone"}
case run.Ended == nil:
open = true
}
out[key] = run
}
if !open {
return out
}
select {
case <-ctx.Done():
return out
case <-wake:
}
}
}
// unescape is a key's part as a name again; a part that does not read stays as it is.
func unescape(part string) string {
if name, err := keys.UnescapeName(part); err == nil {
return name
}
return part
}
// sharedOf names per machine the runs of keys and their asks (§729): from runs where given, else as each key stands.
func (r *compositionRuns) sharedOf(keys []string, runs map[string]meshwants.CompositionRun) []meshwants.Shared {
out := []meshwants.Shared{}
for _, key := range keys {
run, ok := runs[key]
if !ok {
if run, _, ok, _ = r.read(key); !ok {
continue
}
}
out = append(out, meshwants.Shared{Machine: run.Machine, Run: key, Ask: run.Ask})
}
return out
}
// leave removes the composition steps of a superseded or cancelled pipeline from every run's readers (§723, A-469n), and answers
// their asks' ids, each told to stop before a run is ended; a running run left with no reader has its ask dropped and ends could not run, "no reader is left" (A-469z),
// so a later step of the candidate starts a new run. A run other readers read goes on for them.
func (r *compositionRuns) leave(pipeline string, stop func(ids []string)) ([]string, error) {
all, err := r.keys()
if err != nil {
return nil, err
}
var ids []string
var errs []error
for _, key := range all {
if !isRunKey(key) {
continue
}
var left []string
var leaving []meshwants.CompositionReader
run, ok, err := r.change(key, func(c *meshwants.CompositionRun) bool {
left, leaving = nil, nil
keep := c.Readers[:0:0]
for _, reader := range c.Readers {
if reader.Pipeline == pipeline && reader.Step == meshwants.CompositionReaderStepComposition {
left = append(left, reader.ID)
leaving = append(leaving, reader)
continue
}
keep = append(keep, reader)
}
c.Readers = keep
return len(left) > 0
})
if err != nil {
errs = append(errs, err)
continue
}
if !ok || len(left) == 0 {
continue
}
ids = append(ids, left...)
if run.Ended == nil && r.untaken(key, run.Ask) { // a reader leaving a run not yet taken: its wait ends at once (A-470u)
r.sayWaits(run, leaving, "superseded")
}
if stop != nil {
stop(left) // the steps that left say no end, the run's included
}
if run.Ended != nil || len(run.Readers) > 0 {
continue
}
why := "no reader is left: the pipeline " + pipeline + " is superseded or cancelled"
if r.drop != nil {
if err := r.drop(run.Ask, why); err != nil {
r.logf("the drop of the run ask %s of the composition run %s is not answered: %v", run.Ask, key, err)
}
}
if _, err := r.endRun(key, run.Ask, meshwants.CompositionRunOutcomeCouldNotRun, run.Machine+": "+why, nil); err != nil {
errs = append(errs, err)
}
}
return ids, errors.Join(errs...)
}
// passedOn is whether the step of module passed on the machine of an ended run (§722): neither failed nor could not run there.
func passedOn(module string, run meshwants.CompositionRun) bool {
e := judgeRun(module, run)
return e.failed == "" && e.couldNot == ""
}
// formerOf is the place in readers of a step's former ask: the reader of the same pipeline's composition step, or -1.
func formerOf(readers []meshwants.CompositionReader, pipeline string) int {
return slices.IndexFunc(readers, func(c meshwants.CompositionReader) bool {
return c.Pipeline == pipeline && c.Step == meshwants.CompositionReaderStepComposition
})
}
// rejoin is join for a step asked again (§727, A-468g, A-470d): on a machine whose ended run it passed it keeps that verdict,
// reading the run under its new ask; a running run it joins; an ended run it did not read and that could run it reads, as one
// started after its last end; otherwise it starts a new run, replacing the ended key by compare-and-set and carrying every former
// reader into the new value: each that did not pass on the former run marked `rerun` with by the rerun's caller, each that passed
// not (A-470d).
func (r *compositionRuns) rejoin(reader meshwants.CompositionReader, candidate, machine, ask string) (joined, error) {
key := runKeyOf(candidate, machine)
for {
run, rev, ok, err := r.read(key)
if err != nil {
return joined{}, err
}
if !ok {
return r.join(reader, candidate, machine, ask)
}
at := formerOf(run.Readers, reader.Pipeline)
ended := run.Ended != nil
keep := ended && at >= 0 && passedOn(reader.Module, run)
read := !ended || (at < 0 && run.Outcome != meshwants.CompositionRunOutcomeCouldNotRun)
if keep || read {
if at >= 0 && run.Readers[at].ID == reader.ID {
return joined{key: key, run: run}, nil
}
var former []meshwants.CompositionReader
if at >= 0 {
former = []meshwants.CompositionReader{run.Readers[at]}
run.Readers[at] = reader
} else {
run.Readers = append(run.Readers, reader)
}
if err := r.write(key, run, rev); errors.Is(err, errRunChanged) {
continue
} else if err != nil {
return joined{}, err
}
if run.Ended == nil && r.untaken(key, run.Ask) { // as join: a reader of a run not yet taken waits for a build node (A-469y)
r.sayWaits(run, former, "superseded") // the place it takes: that wait ends at once (A-470u)
r.sayWaits(run, []meshwants.CompositionReader{reader}, "")
}
return joined{key: key, run: run}, nil
}
if err := r.room(); err != nil {
return joined{}, err
}
started := r.now().UTC()
fresh := meshwants.CompositionRun{Candidate: candidate, Machine: machine, Ask: ask, Started: &started}
for i, c := range run.Readers {
if i == at {
continue
}
c.Rerun, c.By = !passedOn(c.Module, run), ""
if c.Rerun {
c.By = reader.By
}
fresh.Readers = append(fresh.Readers, c)
}
fresh.Readers = append(fresh.Readers, reader)
if err := r.clearBounds(key, run.Ask, runBoundPrefix, runUntakenPrefix); err != nil { // the former run's bounds go with it
r.logf("the bound keys of the former composition run %s are not deleted: %v", key, err)
}
if err := r.write(key, fresh, rev); errors.Is(err, errRunChanged) {
continue
} else if err != nil {
return joined{}, err
}
if _, err := r.armBound(runUntakenPrefix, key, ask, r.set.untaken); err != nil {
r.logf("the untaken bound of the composition run %s is not armed: %v", key, err)
}
r.sayWaits(fresh, fresh.Readers, "")
return joined{key: key, started: true, run: fresh}, nil
}
}
// write writes a run's value at its revision.
func (r *compositionRuns) write(key string, run meshwants.CompositionRun, rev uint64) error {
raw, err := json.Marshal(run)
if err != nil {
return err
}
if _, err := r.kv.update(key, raw, rev); err != nil {
return err
}
r.heard()
return nil
}
@@ -0,0 +1,404 @@
//go:build integration
package main
import (
"encoding/json"
"fmt"
"strings"
"sync"
"testing"
"time"
"github.com/nats-io/nats.go"
"github.com/nats-io/nats.go/jetstream"
"git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient/enginereads"
"git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
mpr "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/nodebuildgo"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/composer"
"mesh-delivery-assigner/internal/buckets"
)
// Test 108 (design 47 G §733; §718 to §723, §727, §728; A-468 to A-470f): the assigner started whole against the bus composes
// each machine once per candidate. Two or three composition steps of one candidate on two machines make one key, one request and
// one run ask per machine, and each step reads both verdicts; a machine blaming a and b fails their steps and passes c's with a
// warning; a verdict with no `blamed` is judged as before, "the composer names no culprits", and a machine blaming none fails
// every step; a step of another candidate starts its own runs. A taken ask that keeps saying progress is not ended by the bound,
// one silent past it ends could not run with its ask dropped, a step-ended after that is ignored and journaled, and an ask never
// taken ends at run-untaken-bound; a bound holds its run's ask (A-470n). A rerun of a starts one run on the machine it did not
// pass and moves b; a superseded step leaves
// a run running for its other reader; an assigner restarted during a run takes it up by its ask; compositions-drop ends the
// readers and deletes the key; at the cap a step ends could not run, naming the fill.
func TestOneCompositionRunPerCandidateAndMachine(t *testing.T) {
b := startBed(t, "")
b.settings = map[string]string{"MESH_ASSIGNER_COMPOSITION_STEP_BOUND_FILE": "2s", "MESH_ASSIGNER_RUN_UNTAKEN_BOUND_FILE": "15s", // past a restart
"MESH_ASSIGNER_COMPOSITION_RUNS_CAP_MIB_FILE": "1"}
nc, err := nats.Connect(b.srv.ClientURL())
if err != nil {
t.Fatal(err)
}
t.Cleanup(nc.Close)
const commit = "1111111111111111111111111111111111111111"
if _, err := b.js.CreateOrUpdateConsumer(b.ctx, "EVENTS", jetstream.ConsumerConfig{Durable: "n1_mesh-delivery-assigner",
FilterSubjects: []string{enginereads.SubjectPrefix + "*", "mesh.mod." + buckets.IndexerModule + ".event.views.>", meshcatalog.SubjectCatalogRevisionAll,
nodebuildgo.SubjectStepEndedAll, nodebuildgo.SubjectAskTakenAll, nodebuildgo.SubjectStepProgressAll, pipelineEndedSubject},
AckPolicy: jetstream.AckExplicitPolicy, AckWait: 2 * time.Second}); err != nil { // an event handed to the stopped assigner's pull comes again soon
t.Fatal(err)
}
for _, node := range []string{"n1", "n2"} {
raw, _ := json.Marshal(nodeengine.Running{V: 1, Node: node, Module: "engine", Fingerprint: "src2:e1", At: time.Now().UTC()})
if _, err := b.js.Publish(b.ctx, nodeengine.SubjectRunning(node, "engine"), raw); err != nil {
t.Fatal(err)
}
}
awaitKept(t, b, nodeengine.StreamRunning, 2)
engine := meshcatalog.CatalogEntry{Module: "engine", Fp: "src2:e1", Repository: "novox/mesh-host", Commit: commit, Path: ".",
Serves: []string{nodeengine.Seat + ".composition"}, Manifest: map[string]any{"module": "engine", "version": "0.1"}}
b.cat.mu.Lock()
b.cat.entries[trunkBranch] = map[string]meshcatalog.CatalogEntry{"engine": engine}
for _, m := range []string{"a", "b", "c"} {
b.cat.entries[trunkBranch][m] = meshcatalog.CatalogEntry{Module: m, Fp: "src2:" + m, Repository: "novox/" + m, Commit: commit, Path: ".", Manifest: map[string]any{"module": m}}
}
b.cat.rev[trunkBranch] = 3
b.cat.mu.Unlock()
for _, node := range []string{"n1", "n2"} {
for _, m := range []string{"a", "b", "c"} {
b.place(t, node, m)
}
}
var mu sync.Mutex
inputsAsked := map[string]int{} // by candidate and node
var drops []string
respond := func(subject string, f func(m *nats.Msg) any) {
sub, err := nc.Subscribe(subject, func(m *nats.Msg) {
raw, _ := json.Marshal(map[string]any{"result": f(m), "node": "n0"})
_ = m.Respond(raw)
})
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { _ = sub.Unsubscribe() })
}
respond("mesh.seat.node-engine.call.compose-candidate.*.*", func(m *nats.Msg) any {
node := strings.Split(m.Subject, ".")[5]
var in nodeengine.ComposeCandidateInput
_ = json.Unmarshal(m.Data, &in)
mu.Lock()
inputsAsked[in.Candidate+" "+node]++
mu.Unlock()
return map[string]any{"candidate": in.Candidate, "node": node, "verdict": "composed", "input": map[string]any{"node": node}, "modules": []any{}, "own": map[string]any{}, "took": 1, "v": 1}
})
respond("mesh.seat.mesh-catalog.call.entry.*", func(*nats.Msg) any { return meshcatalog.EntryAnswer{Entry: engine} })
respond("mesh.seat.node-build-go.call.drop.*", func(m *nats.Msg) any {
var in nodebuildgo.DropInput
_ = json.Unmarshal(m.Data, &in)
mu.Lock()
drops = append(drops, in.ID)
mu.Unlock()
return map[string]any{}
})
respond("mesh.seat.mesh-hand-acts.call.hand-act.*", func(*nats.Msg) any { return map[string]any{"log": "hand-act-1"} })
// The ends are read from the stream through a durable consumer, as the runner hears them: an end the bus drops as a
// repeated message id is never heard (A-470q).
ended := make(chan meshwants.StepEnded, 32)
runner, err := b.js.CreateOrUpdateConsumer(b.ctx, "EVENTS", jetstream.ConsumerConfig{Durable: "runner-stand-in",
FilterSubject: "mesh.seat.mesh-wants.event.step-ended.n1", AckPolicy: jetstream.AckExplicitPolicy, DeliverPolicy: jetstream.DeliverNewPolicy})
if err != nil {
t.Fatal(err)
}
heard, err := runner.Consume(func(m jetstream.Msg) {
var e meshwants.StepEnded
_ = json.Unmarshal(m.Data(), &e)
_ = m.Ack()
ended <- e
})
if err != nil {
t.Fatal(err)
}
t.Cleanup(heard.Stop)
subscribed(t, nc)
from := b.journal.mark()
_, stop := b.startStoppable(t)
b.journal.await(t, from, "the composition step is heard on", "the composition step served", 30*time.Second)
select {
case <-b.seatListRead:
case <-time.After(30 * time.Second):
t.Fatal("the assigner did not read the seat list within 30 s")
}
queue, _ := buildstep.AskStream(buildstep.AskGo)
worker, err := b.js.CreateOrUpdateConsumer(b.ctx, queue, jetstream.ConsumerConfig{Durable: "stand-in", FilterSubject: "mesh.seat.node-build-go.accept.check.mesh-wants",
AckPolicy: jetstream.AckExplicitPolicy})
if err != nil {
t.Fatal(err)
}
step := func(id, module, run string, rerun bool) {
t.Helper()
s := meshwants.StepRun{Pipeline: "main.3." + module, Step: meshwants.StepRunStepComposition, Module: module, Branch: trunkBranch, Revision: 3,
Commit: commit, Fingerprint: "src2:" + module, Run: run, Rerun: rerun}
if run != "" {
s.Pipeline = "run-" + run + "." + module
}
if rerun {
s.By = "op@n1"
}
raw, _ := json.Marshal(s)
msg := nats.NewMsg(meshwants.AcceptSubjectStep)
msg.Header.Set("x-event-id", id)
msg.Data = raw
if err := nc.PublishMsg(msg); err != nil {
t.Fatal(err)
}
}
type asked struct {
ask buildstep.StepAsk
machine string
}
// asks takes n run asks of the stand-in build seat, each with the machine its request composes.
asks := func(n int) []asked {
t.Helper()
var out []asked
for range n {
got, err := worker.Next(jetstream.FetchMaxWait(20 * time.Second))
if err != nil {
t.Fatalf("%d of %d run asks put: %v", len(out), n, err)
}
_ = got.Ack()
a, err := buildstep.DecodeStepAsk(got.Data())
if err != nil || a.Run == nil {
t.Fatalf("the run ask %s does not read: %v", got.Data(), err)
}
req, err := composer.Decode(readInput(t, nc, a.Run.Input))
if err != nil || len(req.Machines) != 1 || req.BlameTries != 20 {
t.Fatalf("the request of %s: %+v %v", a.ID, req, err)
}
out = append(out, asked{a, req.Machines[0]})
}
return out
}
noMoreAsks := func(what string) {
t.Helper()
if got, err := worker.Next(jetstream.FetchMaxWait(300 * time.Millisecond)); err == nil {
t.Fatalf("%s: one more run ask is put: %s", what, got.Data())
}
}
say := func(event string, node string, body any) {
t.Helper()
raw, _ := json.Marshal(body)
if _, err := b.js.Publish(b.ctx, "mesh.seat.node-build-go.event."+event+"."+node, raw); err != nil {
t.Fatal(err)
}
}
answer := func(a asked, machine string) {
t.Helper()
v := fmt.Sprintf(`{"v":%d,"cases":[{"name":"change","manifests":{},"machines":{%q:%s}}]}`, composer.Version, a.machine, machine)
say("step-ended", "b1", buildstep.StepEnded{V: 1, ID: a.ask.ID, Ask: a.ask.ID, Asker: runAsker, Node: "b1", Outcome: buildstep.OutcomePassed, Output: v, At: time.Now().UTC()})
}
ends := func(n int, what string) map[string]meshwants.StepEnded {
t.Helper()
out := map[string]meshwants.StepEnded{}
for len(out) < n {
select {
case e := <-ended:
out[e.ID] = e
case <-time.After(20 * time.Second):
t.Fatalf("%s: %d of %d steps ended: %+v", what, len(out), n, out)
}
}
return out
}
runKeys := func(candidate string) []string {
all, _ := b.buckets[buckets.CompositionRuns()].Keys(b.ctx)
var out []string
for _, k := range all {
if isRunKey(k) && strings.HasPrefix(k, keysPart(candidate)+".") {
out = append(out, k)
}
}
return out
}
// readers waits, through a watch of the key, until the run of key has n readers.
readers := func(key string, n int) {
t.Helper()
w, err := b.buckets[buckets.CompositionRuns()].Watch(b.ctx, key)
if err != nil {
t.Fatal(err)
}
defer func() { _ = w.Stop() }()
deadline := time.After(10 * time.Second)
for {
select {
case e := <-w.Updates():
var run meshwants.CompositionRun
if e != nil && json.Unmarshal(e.Value(), &run) == nil && len(run.Readers) == n {
return
}
case <-deadline:
t.Fatalf("the run %s has not %d readers", key, n)
}
}
}
blames := `{"composes":false,"reason":"two modules own one path","blamed":[{"module":"a","problem":"/etc/x is a's and b's"},{"module":"b","problem":"/etc/x is a's and b's"}]}`
composes := `{"composes":true,"blamed":[]}`
// One candidate, three steps, two machines: two runs.
for _, m := range []string{"a", "b", "c"} {
step("step-"+m, m, "", false)
}
first := asks(2)
noMoreAsks("three steps of one candidate")
for _, a := range first {
answer(a, map[string]string{"n1": composes, "n2": blames}[a.machine])
}
got := ends(3, "the three steps")
if a, bb, c := got["step-a"], got["step-b"], got["step-c"]; a.Outcome != meshwants.StepEndedOutcomeFailed || !strings.Contains(a.Said, "n2 holds a") ||
bb.Outcome != meshwants.StepEndedOutcomeFailed || c.Outcome != meshwants.StepEndedOutcomePassed || len(c.Warnings) != 2 ||
!strings.Contains(c.Warnings[0], "n2 holds a") || len(c.Shared) != 2 || c.Shared[0].Ask == c.Shared[1].Ask {
t.Fatalf("the steps of one candidate: %+v", got)
}
if keys := runKeys("main.3"); len(keys) != 2 || inputsAsked["main.3 n1"] != 1 || inputsAsked["main.3 n2"] != 1 {
t.Fatalf("keys %v, inputs asked %v: want one run and one input per machine", keys, inputsAsked)
}
// Another candidate (a run on request): its own runs; an old composer and a machine blaming none fail.
step("step-r1", "a", "r1", false)
for _, a := range asks(2) {
answer(a, map[string]string{"n1": `{"composes":false,"reason":"x"}`, "n2": `{"composes":false,"reason":"own","blamed":[]}`}[a.machine])
}
if e := ends(1, "another candidate")["step-r1"]; e.Outcome != meshwants.StepEndedOutcomeFailed || !strings.Contains(e.Said, "n2 does not compose and blames no module") ||
len(e.Warnings) != 1 || e.Warnings[0] != "n1: the composer names no culprits" {
t.Fatalf("a step of another candidate: %+v", e)
}
// The bound: n1's ask taken and saying progress past the bound, then silent; n2's never taken.
from = b.journal.mark()
step("step-r2", "a", "r2", false)
bound := asks(2)
var n1 asked
for _, a := range bound {
if a.machine == "n1" {
n1 = a
}
}
say("ask-taken", "b1", nodebuildgo.AskTaken{Ask: n1.ask.ID, Asker: runAsker, At: time.Now().UTC(), Node: "b1"})
for i := range 3 { // past the 2 s bound, each beat within it
select {
case e := <-ended:
t.Fatalf("a run saying its progress ended: %+v", e)
case <-time.After(time.Second):
}
if i == 0 { // the bound holds its run's ask, published at the key's latest revision with its own time to live (A-470n)
runs := b.buckets[buckets.CompositionRuns()]
all, _ := runs.Keys(b.ctx)
held := ""
for _, k := range all {
if strings.HasPrefix(k, runBoundPrefix) {
if e, err := runs.Get(b.ctx, k); err == nil {
var v boundValue
_ = json.Unmarshal(e.Value(), &v)
held += v.Ask
}
}
}
if held != n1.ask.ID {
t.Fatalf("the bound keys hold the asks %q, want n1's %s alone", held, n1.ask.ID)
}
}
say("step-progress", "b1", nodebuildgo.StepProgress{Ask: n1.ask.ID, Asker: runAsker, At: time.Now().UTC(), Phase: "run"})
}
e := ends(1, "the bounds")["step-r2"]
if e.Outcome != meshwants.StepEndedOutcomeCouldNotRun || !strings.Contains(e.Said, "said no progress within 2s (composition-step-bound)") ||
!strings.Contains(e.Said, "taken by no build node within 15s (run-untaken-bound)") {
t.Fatalf("past the bounds: %+v", e)
}
mu.Lock()
dropped := len(drops)
mu.Unlock()
if dropped != 2 {
t.Fatalf("%d asks dropped past their bounds, want 2", dropped)
}
answer(n1, composes) // heard after the bound: ignored and journaled
b.journal.await(t, from, "the step-ended of the run ask "+n1.ask.ID+" is ignored", "a late step-ended", 10*time.Second)
// A rerun of a: n1 it passed keeps its verdict; n2 it failed starts one run carrying b, which moves.
step("step-a2", "a", "", true)
again := asks(1)
noMoreAsks("a rerun of a")
if again[0].machine != "n2" {
t.Fatalf("the rerun composes %s, want only the machine a did not pass", again[0].machine)
}
answer(again[0], composes)
moved := ends(2, "the rerun")
if a2, bb := moved["step-a2"], moved["step-b"]; a2.Outcome != meshwants.StepEndedOutcomePassed || bb.Outcome != meshwants.StepEndedOutcomePassed ||
!bb.Rerun || bb.By != "op@n1" || len(bb.Shared) != 2 || bb.Shared[1].Ask != again[0].ask.ID {
t.Fatalf("after the rerun (asked again %s): a2 %+v; b %+v", again[0].ask.ID, moved["step-a2"].Shared, moved["step-b"])
}
// A superseded step leaves the runs; its other reader goes on.
step("step-r3a", "a", "r3", false)
step("step-r3b", "b", "r3", false)
sup := asks(2)
readers(runKeyOf("run-r3", "n1"), 2)
readers(runKeyOf("run-r3", "n2"), 2)
pe, _ := json.Marshal(mpr.PipelineEnded{V: 1, Pipeline: "run-r3.a", Module: "a", Branch: trunkBranch, Commit: commit, Outcome: mpr.PipelineEndedOutcomeSuperseded, Run: "r3", Steps: []mpr.StepResult{}})
if _, err := b.js.Publish(b.ctx, "mesh.seat."+mpr.Seat+".event."+mpr.EventPipelineEnded+".n1", pe); err != nil {
t.Fatal(err)
}
for _, a := range sup {
answer(a, composes)
}
if got := ends(1, "the superseded run"); got["step-r3b"].Outcome != meshwants.StepEndedOutcomePassed {
t.Fatalf("the other reader: %+v", got)
}
select {
case e := <-ended:
t.Fatalf("a superseded step said its end: %+v", e)
case <-time.After(200 * time.Millisecond):
}
// Restarted during a run: the new assigner takes it up by its ask.
step("step-r4", "c", "r4", false)
restart := asks(2)
stop()
for _, a := range restart {
answer(a, composes)
}
from = b.journal.mark()
b.startStoppable(t)
b.journal.await(t, from, "is taken up again by its runs (ask step-r4)", "the take-up", 30*time.Second)
if e := ends(1, "the take-up")["step-r4"]; e.Outcome != meshwants.StepEndedOutcomePassed || len(e.Shared) != 2 {
t.Fatalf("the step taken up: %+v", e)
}
// compositions-drop: the readers ended naming the drop, the key deleted.
step("step-r5", "a", "r5", false)
asks(2)
body, _ := json.Marshal(meshwants.CompositionsDropInput{Candidate: "run-r5", Machine: "n1", Why: "stuck"})
reply, err := nc.Request("mesh.seat.mesh-wants.call.compositions-drop.n1~mesh-delivery-pipeline", body, 10*time.Second)
if err != nil || !strings.Contains(string(reply.Data), `"ended":[`) {
t.Fatalf("compositions-drop answered %s %v", reply.Data, err)
}
if e := ends(1, "the drop")["step-r5"]; e.Outcome != meshwants.StepEndedOutcomeCouldNotRun || !strings.Contains(e.Said, "dropped by hand: stuck") {
t.Fatalf("a reader of the dropped run: %+v", e)
}
if keys := runKeys("run-r5"); len(keys) != 1 {
t.Errorf("the keys of run-r5 after the drop: %v, want n2's alone", keys)
}
// At the cap of 1 MiB no run starts: the step ends could not run, naming the fill.
for i := range 2 {
if _, err := b.buckets[buckets.CompositionRuns()].Put(b.ctx, fmt.Sprintf("fill%d", i), make([]byte, 700<<10)); err != nil {
t.Fatal(err)
}
}
step("step-r6", "a", "r6", false)
if e := ends(1, "the cap")["step-r6"]; e.Outcome != meshwants.StepEndedOutcomeCouldNotRun || !strings.Contains(e.Said, "is at its cap of 1 MiB") {
t.Fatalf("at the cap: %+v", e)
}
}
@@ -0,0 +1,642 @@
package main
import (
"context"
"encoding/json"
"fmt"
"maps"
"os"
"path/filepath"
"slices"
"strings"
"sync"
"testing"
"time"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/nodebuildgo"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
)
// runsMem is the state composition-runs in memory, its bound keys' times to live kept beside.
type runsMem struct {
mu sync.Mutex
vals map[string][]byte
revs map[string]uint64
ttl map[string]time.Duration
bytes int64
n uint64
// beforeDel, when set, runs once before the next delete: another write landing between a read and the delete.
beforeDel func()
// beforeArm, when set, runs once before the next arm: another write landing between a read and the arm.
beforeArm func()
}
func (k *runsMem) another() {
k.mu.Lock()
f := k.beforeDel
k.beforeDel = nil
k.mu.Unlock()
if f != nil {
f()
}
}
func newRunsMem() *runsMem {
return &runsMem{vals: map[string][]byte{}, revs: map[string]uint64{}, ttl: map[string]time.Duration{}}
}
func (k *runsMem) get(key string) ([]byte, uint64, error) {
k.mu.Lock()
defer k.mu.Unlock()
return k.vals[key], k.revs[key], nil
}
func (k *runsMem) create(key string, v []byte) (uint64, error) {
k.mu.Lock()
defer k.mu.Unlock()
if _, ok := k.vals[key]; ok {
return 0, errRunChanged
}
k.n++
k.vals[key], k.revs[key] = v, k.n
return k.n, nil
}
func (k *runsMem) update(key string, v []byte, rev uint64) (uint64, error) {
k.mu.Lock()
defer k.mu.Unlock()
if k.revs[key] != rev {
return 0, errRunChanged
}
k.n++
k.vals[key], k.revs[key] = v, k.n
return k.n, nil
}
func (k *runsMem) delAt(key string, rev uint64) error {
k.another()
k.mu.Lock()
defer k.mu.Unlock()
if _, ok := k.vals[key]; !ok {
return nil
}
if k.revs[key] != rev {
return errRunChanged
}
delete(k.vals, key)
delete(k.revs, key)
delete(k.ttl, key)
return nil
}
func (k *runsMem) keys() ([]string, error) {
k.mu.Lock()
defer k.mu.Unlock()
var out []string
for key := range k.vals {
out = append(out, key)
}
slices.Sort(out)
return out, nil
}
func (k *runsMem) arm(key, ask string, ttl time.Duration) (uint64, error) {
k.mu.Lock()
f := k.beforeArm
k.beforeArm = nil
k.mu.Unlock()
if f != nil {
f()
}
raw, _ := json.Marshal(boundValue{Bound: key, Ask: ask})
k.mu.Lock()
defer k.mu.Unlock()
k.n++
k.vals[key], k.revs[key], k.ttl[key] = raw, k.n, ttl
return k.n, nil
}
// expire ends a bound key's time to live: the key gone, as the bus's marker leaves it.
func (k *runsMem) expire(key string) {
k.mu.Lock()
defer k.mu.Unlock()
delete(k.vals, key)
delete(k.revs, key)
delete(k.ttl, key)
}
func (k *runsMem) used() (int64, error) {
k.mu.Lock()
defer k.mu.Unlock()
if k.bytes > 0 {
return k.bytes, nil
}
var n int64
for _, v := range k.vals {
n += int64(len(v))
}
return n, nil
}
// Design 47 G §718, §719, §720, A-468, A-469d, A-469x: a run's key is `<candidate key>.<machine>`, each part escaped; two
// steps of one candidate joining at once start one run and the second reads it; a run that could not run is replaced; at the
// cap no run starts, naming the fill; a run is deleted composition-runs-kept after its end; the settings are read from their files.
func TestACompositionRunIsOneKeyPerCandidateAndMachine(t *testing.T) {
now := time.Date(2026, 11, 17, 12, 0, 0, 0, time.UTC)
step := func(id, module string) meshwants.CompositionReader {
return readerOf(id, meshwants.StepRun{Pipeline: "main.3." + module, Step: meshwants.StepRunStepComposition, Module: module, Branch: "main", Revision: 3})
}
t.Run("key", func(t *testing.T) {
if k := runKeyOf("main.3", "n1"); k != "main=2e3.n1" {
t.Errorf("the key is %q, want each part escaped as a key's name", k)
}
if isRunKey(runBoundPrefix+"main=2e3.n1") || isRunKey(runUntakenPrefix+"main=2e3.n1") || !isRunKey("main=2e3.n1") {
t.Error("a bound key is taken for a run's or a run's for a bound key")
}
})
t.Run("one run for two steps at once", func(t *testing.T) {
kv := newRunsMem()
r := newCompositionRuns(kv, defaultRunSettings, func() time.Time { return now }, t.Logf)
var wg sync.WaitGroup
got := make([]joined, 2)
for i, m := range []string{"a", "b"} {
wg.Add(1)
go func() {
defer wg.Done()
j, err := r.join(step("ask-"+m, m), "main.3", "n1", "run-"+m)
if err != nil {
t.Error(err)
}
got[i] = j
}()
}
wg.Wait()
runKeys := func() []string {
all, _ := kv.keys()
return slices.DeleteFunc(all, func(k string) bool { return !isRunKey(k) })
}
if got[0].started == got[1].started {
t.Fatalf("started %v and %v: want exactly one step to start the run", got[0].started, got[1].started)
}
keys := runKeys()
run, _, _, _ := r.read(runKeyOf("main.3", "n1"))
if len(keys) != 1 || len(run.Readers) != 2 || run.Candidate != "main.3" || run.Machine != "n1" || run.Started == nil {
t.Errorf("keys %v, run %+v: want one key read by both", keys, run)
}
if j, _ := r.join(step("ask-a", "a"), "main.3", "n1", "run-c"); j.started || len(j.run.Readers) != 2 {
t.Errorf("a reader joining again is added again or starts a run: %+v", j)
}
})
t.Run("could not run is never read", func(t *testing.T) {
kv := newRunsMem()
r := newCompositionRuns(kv, defaultRunSettings, func() time.Time { return now }, t.Logf)
if _, err := r.join(step("ask-a", "a"), "main.3", "n1", "run-1"); err != nil {
t.Fatal(err)
}
key := runKeyOf("main.3", "n1")
_, _, _ = r.change(key, func(c *meshwants.CompositionRun) bool {
c.Ended, c.Outcome = &now, meshwants.CompositionRunOutcomeCouldNotRun
return true
})
j, err := r.join(step("ask-b", "b"), "main.3", "n1", "run-2")
if err != nil || !j.started || j.run.Ask != "run-2" || len(j.run.Readers) != 1 || j.run.Ended != nil {
t.Errorf("after a could not run: %+v %v, want a new run read by its starter alone", j, err)
}
_, _, _ = r.change(key, func(c *meshwants.CompositionRun) bool {
c.Ended, c.Outcome = &now, meshwants.CompositionRunOutcomePassed
return true
})
if j, _ := r.join(step("ask-c", "c"), "main.3", "n1", "run-3"); j.started || j.run.Ask != "run-2" {
t.Errorf("a passed run is not read: %+v", j)
}
if j, _ := r.join(step("ask-d", "d"), "main.4", "n1", "run-4"); !j.started {
t.Errorf("a step of another candidate reads the first's run: %+v", j)
}
})
t.Run("cap", func(t *testing.T) {
kv := newRunsMem()
kv.bytes = 16 << 20
r := newCompositionRuns(kv, defaultRunSettings, func() time.Time { return now }, t.Logf)
_, err := r.join(step("ask-a", "a"), "main.3", "n1", "run-1")
if err == nil || !strings.Contains(err.Error(), "at its cap of 16 MiB (16777216 bytes kept)") {
t.Errorf("at the cap: %v, want the fill named", err)
}
})
t.Run("kept", func(t *testing.T) {
kv := newRunsMem()
at := now
r := newCompositionRuns(kv, defaultRunSettings, func() time.Time { return at }, t.Logf)
for _, c := range []string{"main.1", "main.2"} {
if _, err := r.join(step("ask-"+c, "a"), c, "n1", "run-"+c); err != nil {
t.Fatal(err)
}
}
old := now.Add(-25 * time.Hour)
_, _, _ = r.change(runKeyOf("main.1", "n1"), func(c *meshwants.CompositionRun) bool { c.Ended, c.Outcome = &old, "passed"; return true })
_, _ = kv.arm(runBoundPrefix+runKeyOf("main.1", "n1"), "run-main.1", time.Minute)
recent := now.Add(-time.Hour)
_, _, _ = r.change(runKeyOf("main.2", "n1"), func(c *meshwants.CompositionRun) bool { c.Ended, c.Outcome = &recent, "passed"; return true })
if _, err := r.join(step("ask-x", "a"), "main.9", "n1", "run-9"); err != nil {
t.Fatal(err)
}
keys, _ := kv.keys()
for _, k := range []string{runBoundPrefix, runUntakenPrefix} {
if v, _, _ := kv.get(k + runKeyOf("main.1", "n1")); v != nil {
t.Errorf("the key %s stays past its run", k+runKeyOf("main.1", "n1"))
}
}
keys = slices.DeleteFunc(keys, func(k string) bool { return !isRunKey(k) })
if want := []string{runKeyOf("main.2", "n1"), runKeyOf("main.9", "n1")}; !slices.Equal(keys, want) {
t.Errorf("keys %v, want %v: a run ended more than a day ago goes with its bound key at the next run", keys, want)
}
})
t.Run("a listing that misses a key being written", func(t *testing.T) {
kv := &missingRuns{runsMem: newRunsMem()}
r := newCompositionRuns(kv, defaultRunSettings, func() time.Time { return now }, t.Logf)
if _, err := r.join(step("ask-a", "a"), "main.3", "n1", "run-1"); err != nil {
t.Fatal(err)
}
kv.hide = runKeyOf("main.3", "n1")
if key, _, _ := r.keyOfAsk("run-1"); key != "" {
t.Fatalf("the stand's listing does not hide the key")
}
r.saw(kv.hide, true) // as the state's watch hands it
if key, _, _ := r.keyOfAsk("run-1"); key != kv.hide {
t.Errorf("the run of ask run-1 is not found by the keys the watch handed: %q", key)
}
r.saw(kv.hide, false)
if keys, _ := r.keys(); slices.Contains(keys, kv.hide) {
t.Errorf("a key the watch saw deleted is still listed: %v", keys)
}
})
// No delete lands on a value newer than the one it was judged from (the kind test 109 met in test-runs): a rerun's run
// replacing the key, and its untaken bound, stand.
for _, c := range []struct {
name string
ended time.Time
act func(r *compositionRuns, key string) error
}{
{"the sweep of a run replaced meanwhile", now.Add(-25 * time.Hour), func(r *compositionRuns, _ string) error { return r.sweep() }},
{"the end of a run replaced meanwhile", time.Time{}, func(r *compositionRuns, key string) error {
_, err := r.endRun(key, "run-1", meshwants.CompositionRunOutcomePassed, "", nil)
return err
}},
} {
t.Run(c.name, func(t *testing.T) {
kv := newRunsMem()
r := newCompositionRuns(kv, defaultRunSettings, func() time.Time { return now }, t.Logf)
if _, err := r.join(step("ask-a", "a"), "main.3", "n1", "run-1"); err != nil {
t.Fatal(err)
}
key := runKeyOf("main.3", "n1")
if !c.ended.IsZero() {
_, _, _ = r.change(key, func(run *meshwants.CompositionRun) bool { run.Ended, run.Outcome = &c.ended, "failed"; return true })
}
_, _ = kv.arm(runBoundPrefix+key, "run-1", time.Minute)
kv.beforeDel = func() { // a rerun replaces the key and arms its untaken bound
for {
raw, rev, _ := kv.get(key)
var run meshwants.CompositionRun
_ = json.Unmarshal(raw, &run)
if run.Ended == nil {
at := now
run.Ended, run.Outcome = &at, "failed"
}
fresh, _ := json.Marshal(meshwants.CompositionRun{Candidate: "main.3", Machine: "n1", Ask: "run-2", Started: &now, Readers: run.Readers})
if _, err := kv.update(key, fresh, rev); err == nil {
break
}
}
_, _ = kv.arm(runUntakenPrefix+key, "run-2", time.Hour)
}
if err := c.act(r, key); err != nil {
t.Fatal(err)
}
if run, _, ok, _ := r.read(key); !ok || run.Ask != "run-2" || run.Ended != nil {
t.Errorf("the key holds %+v (stands %v), want the rerun's running run-2", run, ok)
}
if v, _, _ := kv.get(runUntakenPrefix + key); v == nil {
t.Error("the untaken bound the rerun's run armed is deleted")
}
})
}
t.Run("settings", func(t *testing.T) {
dir := t.TempDir()
files := map[string]string{"MESH_ASSIGNER_COMPOSITION_RUNS_CAP_MIB_FILE": "8", "MESH_ASSIGNER_COMPOSITION_RUNS_KEPT_FILE": "2h",
"MESH_ASSIGNER_COMPOSITION_STEP_BOUND_FILE": "2s", "MESH_ASSIGNER_RUN_UNTAKEN_BOUND_FILE": "", "MESH_ASSIGNER_BLAME_TRIES_FILE": "5"}
env := map[string]string{}
for name, content := range files {
p := filepath.Join(dir, name)
if err := os.WriteFile(p, []byte(content), 0o600); err != nil {
t.Fatal(err)
}
env[name] = p
}
s, err := runSettingsOf(func(k string) string { return env[k] })
if err != nil || s.capBytes != 8<<20 || s.kept != 2*time.Hour || s.stepBound != 2*time.Second || s.untaken != 24*time.Hour || s.blameTries != 5 {
t.Errorf("settings %+v %v", s, err)
}
_ = os.WriteFile(env["MESH_ASSIGNER_COMPOSITION_STEP_BOUND_FILE"], []byte("30"), 0o600)
if _, err := runSettingsOf(func(k string) string { return env[k] }); err == nil || !strings.Contains(err.Error(), "not a positive Go duration") {
t.Errorf("a bound of no unit: %v", err)
}
if s, err := runSettingsOf(func(string) string { return "" }); err != nil || s != defaultRunSettings {
t.Errorf("no files: %+v %v, want the defaults", s, err)
}
})
raw, _ := json.Marshal(step("x", "a"))
if !strings.Contains(string(raw), `"id":"x"`) {
t.Errorf("a reader names no ask id: %s", raw)
}
}
// Design 47 G §720, A-466s, A-468b, A-469y, A-470: a run's untaken bound is armed at its start and each reader said waiting for a
// build node; ask-taken arms the bound of composition-step-bound and ends the waits ran; each step-progress arms it again; the
// bound's expiry drops the ask and ends the run could not run naming the ask and the bound, a step-ended heard later ignored and
// journaled; the untaken bound's expiry ends it naming run-untaken-bound, the waits superseded; the readers of a run with no end
// are taken up at the start.
func TestACompositionRunsBoundTimesOwedProgress(t *testing.T) {
now := time.Date(2026, 11, 17, 12, 0, 0, 0, time.UTC)
reader := func(id string) meshwants.CompositionReader {
return readerOf(id, meshwants.StepRun{Pipeline: "main.3." + id, Step: meshwants.StepRunStepComposition, Module: id, Branch: "main", Revision: 3})
}
type said struct{ event, how, module string }
setup := func(t *testing.T) (*runsMem, *compositionRuns, *[]said, *[]string, *[]string) {
kv := newRunsMem()
var saids []said
var drops, journal []string
var mu sync.Mutex
r := newCompositionRuns(kv, defaultRunSettings, func() time.Time { return now }, func(f string, a ...any) {
mu.Lock()
journal = append(journal, fmt.Sprintf(f, a...))
mu.Unlock()
})
r.say = func(event string, body any, _ string) error {
w := body.(meshwants.Wait)
if w.On != waitOnBuildNode || w.Step != "pipeline" || w.Owner != meshwants.Seat || w.Node == "" {
t.Errorf("the wait said %+v", w)
}
saids = append(saids, said{event, w.How, w.Module})
return nil
}
r.drop = func(ask, why string) error { drops = append(drops, ask+": "+why); return nil }
return kv, r, &saids, &drops, &journal
}
key := runKeyOf("main.3", "n1")
t.Run("taken, progress, bound", func(t *testing.T) {
kv, r, saids, drops, journal := setup(t)
if _, err := r.join(reader("a"), "main.3", "n1", "run-1"); err != nil {
t.Fatal(err)
}
if _, err := r.join(reader("b"), "main.3", "n1", "run-2"); err != nil {
t.Fatal(err)
}
if kv.ttl[runUntakenPrefix+key] != 24*time.Hour || !slices.Equal(*saids, []said{{meshwants.EventWaitHeld, "", "a"}, {meshwants.EventWaitHeld, "", "b"}}) {
t.Fatalf("at the start: untaken %v, said %v", kv.ttl, *saids)
}
if err := r.heardAskTaken(nodebuildgo.AskTaken{Ask: "run-1", Asker: "someone-else"}); err != nil || kv.ttl[runBoundPrefix+key] != 0 {
t.Fatalf("another asker's ask-taken arms a bound: %v %v", kv.ttl, err)
}
if err := r.heardAskTaken(nodebuildgo.AskTaken{Ask: "run-1", Asker: runAsker, Node: "b1"}); err != nil {
t.Fatal(err)
}
_, untaken, _ := kv.get(runUntakenPrefix + key)
if kv.ttl[runBoundPrefix+key] != 30*time.Minute || untaken != 0 || len(*saids) != 4 || (*saids)[2].how != "ran" || (*saids)[3].how != "ran" {
t.Fatalf("at ask-taken: %v, said %v", kv.ttl, *saids)
}
before := kv.revs[runBoundPrefix+key]
if err := r.heardProgress(nodebuildgo.StepProgress{Ask: "run-1", Asker: runAsker}); err != nil || kv.revs[runBoundPrefix+key] == before {
t.Fatalf("a step-progress does not arm the bound again: %v", err)
}
kv.expire(runBoundPrefix + key)
r.expired(runBoundPrefix + key)
run, _, _, _ := r.read(key)
if run.Outcome != meshwants.CompositionRunOutcomeCouldNotRun || run.Said != "n1: its run ask run-1 said no progress within 30m0s (composition-step-bound)" ||
len(*drops) != 1 || !strings.HasPrefix((*drops)[0], "run-1: ") {
t.Fatalf("past the bound: %+v, drops %v", run, *drops)
}
if got := judgeRun("a", run); got.couldNot != run.Said {
t.Errorf("a reader of the run past its bound: %+v", got)
}
late := buildstep.StepEnded{Ask: "run-1", Asker: runAsker, Outcome: buildstep.OutcomePassed, Output: "{}"}
if err := r.heardEnd(late, func(e buildstep.StepEnded) ([]byte, error) { return []byte(e.Output), nil }); err != nil {
t.Fatal(err)
}
if again, _, _, _ := r.read(key); again.Said != run.Said || !slices.ContainsFunc(*journal, func(l string) bool {
return strings.Contains(l, "step-ended of the run ask run-1 is ignored") && strings.Contains(l, key)
}) {
t.Errorf("a step-ended after the bound: %+v, journal %v", again, *journal)
}
if keys, _ := kv.keys(); !slices.Equal(keys, []string{key}) {
t.Errorf("the bound keys stay past the run's end: %v", keys)
}
})
t.Run("untaken", func(t *testing.T) {
kv, r, saids, drops, _ := setup(t)
if _, err := r.join(reader("a"), "main.3", "n1", "run-1"); err != nil {
t.Fatal(err)
}
kv.expire(runUntakenPrefix + key)
r.expired(runUntakenPrefix + key)
run, _, _, _ := r.read(key)
if run.Outcome != meshwants.CompositionRunOutcomeCouldNotRun || run.Said != "n1: its run ask run-1 was taken by no build node within 24h0m0s (run-untaken-bound)" ||
len(*drops) != 1 || !slices.Equal(*saids, []said{{meshwants.EventWaitHeld, "", "a"}, {meshwants.EventWaitEnded, "superseded", "a"}}) {
t.Errorf("untaken past its bound: %+v, drops %v, said %v", run, *drops, *saids)
}
r.expired(runUntakenPrefix + key) // a run ended takes nothing
if len(*drops) != 1 {
t.Errorf("an ended run is dropped again: %v", *drops)
}
})
// A-470n, A-470o: a bound holds its run's ask, armed for it alone; a late signal of a run replaced moves nothing and is
// journaled; an expiry ends the run only while its bound is still absent and the run taken (bound.) or untaken (untaken.).
rerun := func(kv *runsMem, r *compositionRuns) func() { // a rerun replaces run-1 by run-2, its bounds gone, run-2's untaken armed
return func() {
_, _, _ = r.change(key, func(c *meshwants.CompositionRun) bool { c.Ask = "run-2"; return true })
kv.expire(runBoundPrefix + key)
_, _ = kv.arm(runUntakenPrefix+key, "run-2", time.Hour)
}
}
taken := func(t *testing.T, r *compositionRuns) {
if err := r.heardAskTaken(nodebuildgo.AskTaken{Ask: "run-1", Asker: runAsker, Node: "b1"}); err != nil {
t.Fatal(err)
}
}
for _, c := range []struct {
name string
act func(t *testing.T, kv *runsMem, r *compositionRuns)
ended bool
bound string // the ask the bound key holds, "" for none
untaken string
journal string
}{
{"a late ask-taken of a run replaced as it is heard", func(t *testing.T, kv *runsMem, r *compositionRuns) {
kv.beforeArm = rerun(kv, r)
taken(t, r)
}, false, "", "run-2", "the ask-taken of the run ask run-1 is late"},
{"a late step-progress of a run replaced as it is heard", func(t *testing.T, kv *runsMem, r *compositionRuns) {
taken(t, r)
kv.beforeArm = rerun(kv, r)
if err := r.heardProgress(nodebuildgo.StepProgress{Ask: "run-1", Asker: runAsker}); err != nil {
t.Fatal(err)
}
kv.expire(runBoundPrefix + key) // a bound left standing would end run-2 here
r.expired(runBoundPrefix + key)
}, false, "", "run-2", "the step-progress of the run ask run-1 is late"},
{"a step-progress of a run gone", func(t *testing.T, kv *runsMem, r *compositionRuns) {
taken(t, r)
rerun(kv, r)()
if err := r.heardProgress(nodebuildgo.StepProgress{Ask: "run-1", Asker: runAsker}); err != nil {
t.Fatal(err)
}
}, false, "", "run-2", "the step-progress of the run ask run-1 is late"},
{"an expiry heard after the bound was armed again", func(t *testing.T, kv *runsMem, r *compositionRuns) {
taken(t, r)
r.expired(runBoundPrefix + key)
}, false, "run-1", "", "the expiry of " + runBoundPrefix + key + " ends nothing"},
{"the bound's expiry of a run not taken", func(t *testing.T, kv *runsMem, r *compositionRuns) {
_, _ = kv.arm(runBoundPrefix+key, "run-1", time.Minute)
kv.expire(runBoundPrefix + key)
r.expired(runBoundPrefix + key)
}, false, "", "run-1", "the expiry of " + runBoundPrefix + key + " ends nothing"},
{"the untaken expiry of a run taken", func(t *testing.T, kv *runsMem, r *compositionRuns) {
_, _ = kv.arm(runBoundPrefix+key, "run-1", time.Minute)
kv.expire(runUntakenPrefix + key)
r.expired(runUntakenPrefix + key)
}, false, "run-1", "", "the expiry of " + runUntakenPrefix + key + " ends nothing"},
{"an end of another ask", func(t *testing.T, kv *runsMem, r *compositionRuns) {
if ended, err := r.end(key, "run-0", meshwants.CompositionRunOutcomePassed, "", nil); ended || err != nil {
t.Errorf("the end of run-0 ended the run of run-1: %v %v", ended, err)
}
}, false, "", "run-1", ""},
{"the ask-taken of the run's own ask", func(t *testing.T, kv *runsMem, r *compositionRuns) {
taken(t, r)
}, false, "run-1", "", ""},
} {
t.Run(c.name, func(t *testing.T) {
kv, r, _, _, journal := setup(t)
if _, err := r.join(reader("a"), "main.3", "n1", "run-1"); err != nil {
t.Fatal(err)
}
c.act(t, kv, r)
run, _, _, _ := r.read(key)
if (run.Ended != nil) != c.ended {
t.Errorf("the run ended %v (%s), want %v", run.Ended != nil, run.Said, c.ended)
}
for prefix, want := range map[string]string{runBoundPrefix: c.bound, runUntakenPrefix: c.untaken} {
if held, _, _, _ := r.boundOf(prefix + key); held != want {
t.Errorf("%s holds the ask %q, want %q", prefix+key, held, want)
}
}
if c.journal != "" && !slices.ContainsFunc(*journal, func(l string) bool { return strings.Contains(l, c.journal) }) {
t.Errorf("the journal %v does not say %q", *journal, c.journal)
}
})
}
// A-469y, A-470u: a step asked again that joins a running run not yet taken, beside a reader or in its pipeline's former
// reader's place, says its own wait held, as join does; the former reader's wait, and that of a reader leaving, ends at once
// superseded.
held := func(m string) said { return said{meshwants.EventWaitHeld, "", m} }
gone := func(m string) said { return said{meshwants.EventWaitEnded, "superseded", m} }
for _, c := range []struct {
name string
act func(t *testing.T, r *compositionRuns)
want []said
}{
{"a rerun joins", func(t *testing.T, r *compositionRuns) {
again := reader("b")
again.Rerun = true
if _, err := r.rejoin(again, "main.3", "n1", "run-2"); err != nil {
t.Fatal(err)
}
}, []said{held("a"), held("b")}},
{"a rerun takes its former place", func(t *testing.T, r *compositionRuns) {
again := reader("a2")
again.Pipeline, again.Module, again.Rerun = "main.3.a", "a2", true
if _, err := r.rejoin(again, "main.3", "n1", "run-2"); err != nil {
t.Fatal(err)
}
}, []said{held("a"), gone("a"), held("a2")}},
{"a reader leaves", func(t *testing.T, r *compositionRuns) {
if _, err := r.join(reader("b"), "main.3", "n1", "run-2"); err != nil {
t.Fatal(err)
}
if _, err := r.leave("main.3.a", nil); err != nil {
t.Fatal(err)
}
}, []said{held("a"), held("b"), gone("a")}},
} {
t.Run(c.name, func(t *testing.T) {
_, r, saids, _, _ := setup(t)
if _, err := r.join(reader("a"), "main.3", "n1", "run-1"); err != nil {
t.Fatal(err)
}
c.act(t, r)
if !slices.Equal(*saids, c.want) {
t.Errorf("said %v, want %v", *saids, c.want)
}
})
}
t.Run("taken up at the start", func(t *testing.T) {
_, r, _, _, _ := setup(t)
for _, c := range []struct{ id, machine string }{{"a", "n1"}, {"a", "n2"}, {"b", "n1"}} {
if _, err := r.join(reader(c.id), "main.3", c.machine, "run-"+c.machine); err != nil {
t.Fatal(err)
}
}
ended := now
_, _, _ = r.change(runKeyOf("main.3", "n2"), func(c *meshwants.CompositionRun) bool { c.Ended, c.Outcome = &ended, "passed"; return true })
// A rerun's run carrying readers whose steps said their end (A-470l, A-470m): c passed and is not taken up, d is marked rerun.
_, _, _ = r.change(runKeyOf("main.3", "n1"), func(run *meshwants.CompositionRun) bool {
for _, id := range []string{"c", "d"} {
c := reader(id)
c.Ended, c.Rerun = &ended, id == "d"
run.Readers = append(run.Readers, c)
}
return true
})
readers, err := r.readersOfOpen()
if err != nil || len(readers) != 3 || readers[0].ID != "a" || readers[1].ID != "b" || readers[2].ID != "d" {
t.Fatalf("the readers taken up: %+v %v", readers, err)
}
if keys, _ := r.keysOf("main.3", "a"); !slices.Equal(keys, []string{runKeyOf("main.3", "n1"), runKeyOf("main.3", "n2")}) {
t.Errorf("the runs of reader a: %v", keys)
}
// A-470q: a reader with no `ended` says its first end under its ask's id; d, marked rerun, says its end again under
// `<id>.<the open run's ask>`.
ids := make(chan [2]string, 3)
steps := &compositionSteps{node: "n1", now: func() time.Time { return now }, logf: t.Logf,
resume: func(context.Context, string, meshwants.StepRun) stepOutcome {
return stepOutcome{Outcome: meshwants.StepEndedOutcomePassed}
},
say: func(_ string, body any, id string) error {
ids <- [2]string{body.(meshwants.StepEnded).ID, id}
return nil
}}
steps.takeUp(context.Background(), r)
got := map[string]string{}
for range 3 {
select {
case e := <-ids:
got[e[0]] = e[1]
case <-time.After(5 * time.Second):
t.Fatalf("the ends of the take-up: %v", got)
}
}
if want := map[string]string{"a": "a", "b": "b", "d": "d.run-n1"}; !maps.Equal(got, want) {
t.Errorf("the message ids of the take-up's ends: %v, want %v", got, want)
}
})
}
// missingRuns is runsMem whose listing misses one key, as a bucket's listing misses a key being written at that moment.
type missingRuns struct {
*runsMem
hide string
}
func (k *missingRuns) keys() ([]string, error) {
all, err := k.runsMem.keys()
return slices.DeleteFunc(all, func(key string) bool { return key == k.hide }), err
}
@@ -0,0 +1,162 @@
package main
import (
"encoding/json"
"errors"
"fmt"
"slices"
"strings"
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/process"
)
// The composition runs' read and drop (design 47 G §728; A-469f, A-469u, A-469v): the seat mesh-wants' verbs `compositions`
// (class read) and `compositions-drop` (class act, §391's default callers), answered by the assigner's process, which keeps the
// runs and says the readers' ends; the module's tools `assigner_compositions` and `assigner_compositions_drop` call them.
// The tools that call the two verbs.
const (
compositionsTool = "assigner_compositions"
compositionsDropTool = "assigner_compositions_drop"
)
// compositions answers each composition run the state keeps, under §719's field names plus its key, with the candidate and the
// machine named only those, and the state's fill against its cap.
func (r *compositionRuns) compositions(in meshwants.CompositionsInput) (meshwants.CompositionsAnswer, error) {
all, err := r.keys()
if err != nil {
return meshwants.CompositionsAnswer{}, fmt.Errorf("the state %s is not listed: %w", "composition-runs", err)
}
slices.Sort(all)
out := meshwants.CompositionsAnswer{Runs: []meshwants.CompositionRun{}}
for _, key := range all {
if !isRunKey(key) {
continue
}
run, _, ok, err := r.read(key)
if err != nil || !ok || (in.Candidate != "" && run.Candidate != in.Candidate) || (in.Machine != "" && run.Machine != in.Machine) {
continue
}
run.Key = key
out.Runs = append(out.Runs, run)
}
out.Fill, err = r.fill()
return out, err
}
// drop drops one composition run by hand (§728): the act and why written in the hand-act log first (record), then a running run's
// ask dropped, each of its readers' waits stopped and, for each reader whose end is owed (no `ended`, or marked rerun), its end
// said could not run naming the drop, once (A-470r), and the key deleted with its bound keys. It answers the entry deleted and
// the readers it ended.
func (c *compositionSteps) drop(r *compositionRuns, record func(meshhandactsclient.Request) error, caller string, in meshwants.CompositionsDropInput) (meshwants.CompositionsDropAnswer, error) {
why := strings.TrimSpace(in.Why)
if in.Candidate == "" || in.Machine == "" || why == "" {
return meshwants.CompositionsDropAnswer{}, errors.New("name the candidate, the machine and why the composition run is dropped")
}
key := runKeyOf(in.Candidate, in.Machine)
run, _, ok, err := r.read(key)
if err != nil {
return meshwants.CompositionsDropAnswer{}, err
}
if !ok {
return meshwants.CompositionsDropAnswer{}, fmt.Errorf("no composition run of %s on %s is kept", in.Candidate, in.Machine)
}
if err := record(meshhandactsclient.Request{What: meshwants.VerbCompositionsDrop + " " + key, Why: why + " (" + caller + ")", Cause: "compositions-drop"}); err != nil {
return meshwants.CompositionsDropAnswer{}, fmt.Errorf("the hand act was not recorded, so nothing was dropped: %w", err)
}
said := fmt.Sprintf("%s: the composition run %s was dropped by hand: %s", in.Machine, key, why)
answer := meshwants.CompositionsDropAnswer{Run: run}
answer.Run.Key = key
if run.Ended == nil {
if r.drop != nil {
if err := r.drop(run.Ask, said); err != nil {
r.logf("the drop of the run ask %s of the composition run %s is not answered: %v", run.Ask, key, err)
}
}
ids := make([]string, 0, len(run.Readers))
for _, reader := range run.Readers {
ids = append(ids, reader.ID)
}
c.leave(ids) // their waits say no end of their own
// The run ends without moving its readers: the drop says each owed end itself, once (A-470r).
if _, err := r.endRunMoving(key, run.Ask, meshwants.CompositionRunOutcomeCouldNotRun, said, nil, r.untaken(key, run.Ask), false); err != nil {
return answer, err
}
shared := []meshwants.Shared{{Machine: run.Machine, Run: key, Ask: run.Ask}}
for _, reader := range run.Readers {
if reader.Ended != nil && !reader.Rerun {
continue // it ended passed already and keeps its verdict (A-470r)
}
again := "" // a reader whose step said its end already says it again under the dropped run's ask (A-470q)
if reader.Ended != nil {
again = run.Ask
}
c.sayEnd(reader.ID, stepRunOf(reader), nil, stepOutcome{Outcome: meshwants.StepEndedOutcomeCouldNotRun, Said: said, Shared: shared}, again)
answer.Ended = append(answer.Ended, reader)
}
}
// The dropped run's key goes while it holds that run: a run started on it since stands.
err = r.deleteRun(key, func(c meshwants.CompositionRun) bool { return c.Ask == run.Ask })
r.heard()
return answer, err
}
// compositionVerbs are the process's handlers of the seat mesh-wants' verbs compositions and compositions-drop.
func compositionVerbs(r *compositionRuns, c *compositionSteps, record func(meshhandactsclient.Request) error) map[string]process.SeatHandler {
return map[string]process.SeatHandler{
meshwants.VerbCompositions: func(_ string, raw json.RawMessage) (any, error) {
var in meshwants.CompositionsInput
if len(raw) > 0 {
if err := json.Unmarshal(raw, &in); err != nil {
return nil, fmt.Errorf("the arguments are not JSON: %w", err)
}
}
return r.compositions(in)
},
meshwants.VerbCompositionsDrop: func(caller string, raw json.RawMessage) (any, error) {
var in meshwants.CompositionsDropInput
if err := json.Unmarshal(raw, &in); err != nil {
return nil, fmt.Errorf("the arguments are not JSON: %w", err)
}
return c.drop(r, record, caller, in)
},
}
}
// compositionsTools are the module's tools of §728's names, each calling its verb (A-469f).
func compositionsTools(ask func(string, any) (json.RawMessage, error)) []stdio.Tool {
call := func(verb string, args map[string]any, names ...string) (any, error) {
in := map[string]any{}
for _, n := range names {
if v := arg(args, n); v != "" {
in[n] = v
}
}
raw, err := ask("seat:"+meshwants.Seat+"."+verb, in)
if err != nil {
return nil, err
}
var out any
if err := json.Unmarshal(raw, &out); err != nil {
return nil, fmt.Errorf("%s answered what is not JSON: %w", verb, err)
}
return out, nil
}
return []stdio.Tool{
{Name: compositionsTool, Description: "The composition runs the assigner keeps, one per candidate and machine (design 47 G §719, §728): each with " +
"its program, input digest, ask, readers, outcome and verdict, and the state's fill against its cap; with candidate or machine, only those. Read-only.",
Input: schema(map[string]string{"candidate": "the candidate's key: <branch>.<revision>, or run-<id>", "machine": "a machine"}, nil),
Run: func(args map[string]any) (any, error) {
return call(meshwants.VerbCompositions, args, "candidate", "machine")
}},
{Name: compositionsDropTool, Description: "Drop one composition run by hand (design 47 G §728): written in the hand-act log first, then its ask " +
"is dropped, each reader ended could not run naming the drop, and the key deleted.",
Input: schema(map[string]string{"candidate": "the candidate's key", "machine": "the machine", "why": "why the run is dropped"}, []string{"candidate", "machine", "why"}),
Run: func(args map[string]any) (any, error) {
return call(meshwants.VerbCompositionsDrop, args, "candidate", "machine", "why")
}},
}
}
@@ -0,0 +1,91 @@
package main
import (
"encoding/json"
"errors"
"strings"
"testing"
"time"
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
)
// Design 47 G §728, A-469f, A-469u, A-469v: compositions answers each run with its key and the fill, only those of a candidate or
// machine when named; compositions-drop writes the hand act first (nothing is dropped when it is not recorded), drops a running
// run's ask, ends each reader could not run naming the drop and deletes the key with its bound keys; the tools call the verbs.
func TestTheCompositionRunsAreReadAndDroppedByTheirVerbs(t *testing.T) {
now := time.Date(2026, 11, 17, 12, 0, 0, 0, time.UTC)
kv := newRunsMem()
r := newCompositionRuns(kv, defaultRunSettings, func() time.Time { return now }, t.Logf)
var drops []string
r.drop = func(ask, why string) error { drops = append(drops, ask); return nil }
ends := newSaidEvents()
var endIDs []string // the message id of each end said
c := &compositionSteps{node: "n1", now: func() time.Time { return now }, logf: t.Logf, say: func(event string, body any, id string) error {
endIDs = append(endIDs, id)
return ends.say(event, body, id)
}}
moves := 0
move := func(meshwants.CompositionRun) { moves++ }
r.moved.Store(&move)
for _, m := range []string{"n1", "n2"} {
if _, err := r.join(readerOf("ask-a", meshwants.StepRun{Pipeline: "main.3.a", Step: meshwants.StepRunStepComposition, Module: "a"}), "main.3", m, "run-"+m); err != nil {
t.Fatal(err)
}
}
// A-470r: n2's run carries a reader that ended passed (p) and one marked rerun (q); only q's end is owed, said once.
_, _, _ = r.change(runKeyOf("main.3", "n2"), func(run *meshwants.CompositionRun) bool {
for _, id := range []string{"ask-p", "ask-q"} {
c := readerOf(id, meshwants.StepRun{Pipeline: "main.3." + id, Step: meshwants.StepRunStepComposition, Module: id})
c.Ended, c.Rerun = &now, id == "ask-q"
run.Readers = append(run.Readers, c)
}
return true
})
var recorded []meshhandactsclient.Request
record := func(q meshhandactsclient.Request) error { recorded = append(recorded, q); return nil }
verbs := compositionVerbs(r, c, record)
out, err := verbs[meshwants.VerbCompositions]("op", json.RawMessage(`{"machine":"n2"}`))
read, _ := out.(meshwants.CompositionsAnswer)
if err != nil || len(read.Runs) != 1 || read.Runs[0].Key != runKeyOf("main.3", "n2") || read.Runs[0].Ask != "run-n2" || len(read.Runs[0].Readers) != 3 ||
read.Fill.Store != "composition-runs" || read.Fill.Cap != 16<<20 || read.Fill.Bytes == 0 {
t.Fatalf("compositions = %+v %v", out, err)
}
refuse := compositionVerbs(r, c, func(meshhandactsclient.Request) error { return errors.New("no holder") })
if _, err := refuse[meshwants.VerbCompositionsDrop]("op", json.RawMessage(`{"candidate":"main.3","machine":"n2","why":"stuck"}`)); err == nil ||
!strings.Contains(err.Error(), "nothing was dropped") || len(drops) != 0 {
t.Fatalf("a drop not recorded: %v, drops %v", err, drops)
}
out, err = verbs[meshwants.VerbCompositionsDrop]("op@n1", json.RawMessage(`{"candidate":"main.3","machine":"n2","why":"stuck"}`))
dropped, _ := out.(meshwants.CompositionsDropAnswer)
if err != nil || dropped.Run.Key != runKeyOf("main.3", "n2") || len(dropped.Ended) != 2 || dropped.Ended[0].ID != "ask-a" || dropped.Ended[1].ID != "ask-q" ||
moves != 0 || len(endIDs) != 2 || endIDs[0] != "ask-a" || endIDs[1] != "ask-q.run-n2" ||
len(recorded) != 1 || recorded[0].Why != "stuck (op@n1)" || len(drops) != 1 || drops[0] != "run-n2" {
t.Fatalf("compositions-drop = %+v %v, recorded %+v, drops %v, moves %d, ends %v", out, err, recorded, drops, moves, endIDs)
}
end, _ := ends.said[meshwants.EventStepEnded+".n1"].(meshwants.StepEnded)
if end.ID != "ask-q" || end.Outcome != meshwants.StepEndedOutcomeCouldNotRun || !strings.Contains(end.Said, "dropped by hand: stuck") ||
len(end.Shared) != 1 || end.Shared[0].Ask != "run-n2" {
t.Errorf("the reader's end %+v", end)
}
if keys, _ := kv.keys(); len(keys) != 2 || keys[0] != runKeyOf("main.3", "n1") {
t.Errorf("keys after the drop %v, want n1's run and its untaken key", keys)
}
// The tools call the verbs with what they were given.
var asked []string
tools := compositionsTools(func(key string, body any) (json.RawMessage, error) {
raw, _ := json.Marshal(body)
asked = append(asked, key+" "+string(raw))
return json.RawMessage(`{"runs":[],"fill":{"store":"composition-runs","bytes":0,"cap":1}}`), nil
})
for _, tool := range tools {
if _, err := tool.Run(map[string]any{"candidate": "main.3", "machine": "n1", "why": "x"}); err != nil {
t.Fatal(err)
}
}
if len(tools) != 2 || tools[0].Name != compositionsTool || tools[1].Name != compositionsDropTool ||
asked[0] != `seat:mesh-wants.compositions {"candidate":"main.3","machine":"n1"}` || asked[1] != `seat:mesh-wants.compositions-drop {"candidate":"main.3","machine":"n1","why":"x"}` {
t.Errorf("the tools asked %v", asked)
}
}
@@ -0,0 +1,268 @@
package main
import (
"context"
"encoding/json"
"strings"
"sync"
"time"
"github.com/nats-io/nats.go"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-sdk/go/process"
"git.novox.be/novox/mesh-sdk/go/seatdef"
)
// The composition step (design 47 G §22, §354, §63): the assigner takes the seat mesh-wants' accepted kind `step`, the
// composition step of one module's pipeline that the runner asks, runs it, and says its end as the seat's event
// step-ended.<node>, the ask's id as the event's id and the event's `id`, which the runner holds the end to.
// stepOutcome is what one composition step came to.
type stepOutcome struct {
Outcome string
Said string
Warnings []string
// Shared names per machine composed the composition run the step read and its ask (design 47 G §723, §729).
Shared []meshwants.Shared
}
// compositionSteps takes the composition steps and says their ends.
type compositionSteps struct {
node string
// say says one event of the seat mesh-wants (wantsPublisher).
say publisher
// run runs one step and answers what it came to; resume judges a step taken up at the start from its runs (takeUp).
run func(ctx context.Context, id string, run meshwants.StepRun) stepOutcome
resume func(ctx context.Context, id string, run meshwants.StepRun) stepOutcome
// ended writes, once the step asked under id said its end, that time on its reader in each run naming it (A-470m); nil
// writes none.
ended func(id string, run meshwants.StepRun, at time.Time)
now func() time.Time
logf func(string, ...any)
// asker is the name the step's progress names as its asker, read when it is said (stepAskerOf).
asker func() string
// ticks is a ticker of every d, its channel and its stop (time.NewTicker); nil is the clock's. A test hands its own.
ticks func(d time.Duration) (<-chan time.Time, func())
mu sync.Mutex
// stops ends the wait of a running step by its ask's id, when its pipeline is superseded or cancelled (leave).
stops map[string]context.CancelFunc
}
// stepAskerOf is the asker a composition step's progress names: the one caller the seat mesh-wants' definition lists for its
// accepted kind step, read from the seat list when it is said, since that subject names no asker (design 47 G A-294, which
// corrects A-267). Empty while the seat list holds no definition naming exactly one.
func stepAskerOf(definition func() (seatdef.Definition, bool)) func() string {
return func() string {
d, ok := definition()
if !ok {
return ""
}
var one string
for _, m := range d.Accepts {
if m.Name != meshwants.AcceptStep || m.Callers == nil {
continue
}
for _, e := range m.Callers.List {
name, isSeat := strings.CutPrefix(e, seatdef.CallerSeatPrefix)
if !isSeat || (one != "" && one != name) {
return ""
}
one = name
}
}
return one
}
}
// progressEvery is how often a running composition step says its progress (design 47 G §496, A-262).
const progressEvery = time.Minute
// stepPhase is the phase a running step is in: fetch, build, run or report (§496), set by the run through its context, and the
// composition runs it waits on (§723, §729).
type stepPhase struct {
mu sync.Mutex
phase string
shared []meshwants.Shared
}
// setShared names the runs the step ctx runs waits on, when it runs one.
func setShared(ctx context.Context, shared []meshwants.Shared) {
if p, ok := ctx.Value(phaseKey{}).(*stepPhase); ok {
p.mu.Lock()
p.shared = shared
p.mu.Unlock()
}
}
func (p *stepPhase) waitsOn() []meshwants.Shared {
p.mu.Lock()
defer p.mu.Unlock()
return p.shared
}
type phaseKey struct{}
// setPhase sets the phase of the step ctx runs, when it runs one.
func setPhase(ctx context.Context, phase string) {
if p, ok := ctx.Value(phaseKey{}).(*stepPhase); ok {
p.mu.Lock()
p.phase = phase
p.mu.Unlock()
}
}
func (p *stepPhase) get() string {
p.mu.Lock()
defer p.mu.Unlock()
return p.phase
}
// take takes one ask of the accepted kind `step` by its id and body: a step that is no composition step, or an ask with no
// id, is left with a log line; one taken is run in its own goroutine and its end said.
func (c *compositionSteps) take(ctx context.Context, id string, data []byte) bool {
var run meshwants.StepRun
if err := json.Unmarshal(data, &run); err != nil || id == "" || run.Step != meshwants.StepRunStepComposition {
c.logf("a step ask that is no composition step with an id is left: %v", err)
return false
}
go c.say1(ctx, id, run, c.run, "")
return true
}
// say1 runs one step with how and says its end, naming in `shared` the runs it read (§723); again is, for an end said again, the
// ask of the run whose end makes it say again (sayEnd). A step whose wait was ended by its pipeline's supersede or cancel (leave)
// says nothing: the runner ended it already.
func (c *compositionSteps) say1(ctx context.Context, id string, run meshwants.StepRun, how func(context.Context, string, meshwants.StepRun) stepOutcome, again string) {
started := c.now().UTC()
ctx, stopWait := context.WithCancel(ctx)
c.mu.Lock()
if c.stops == nil {
c.stops = map[string]context.CancelFunc{}
}
if c.stops[id] != nil { // the step asked under id is running already: it says its own end
c.mu.Unlock()
stopWait()
return
}
c.stops[id] = stopWait
c.mu.Unlock()
defer func() {
c.mu.Lock()
delete(c.stops, id)
c.mu.Unlock()
stopWait()
}()
phase := &stepPhase{phase: meshwants.StepProgressEventPhaseFetch}
stop := c.sayProgress(id, phase)
o := how(context.WithValue(ctx, phaseKey{}, phase), id, run)
stop()
if ctx.Err() != nil {
c.logf("the composition step %s of %s says no end: its wait ended (%v)", id, run.Pipeline, context.Cause(ctx))
return
}
c.sayEnd(id, run, &started, o, again)
}
// sayEnd says the end of the step asked under id as the seat's step-ended.<node>, its id the ask's; once said, its time is
// written as its reader's `ended` (A-470m). Its first end's message id is the ask's id; an end said again is published under
// `<ask id>.<again>`, again the ask of the run whose end makes it say again, so the bus's deduplication never drops it (A-470q).
func (c *compositionSteps) sayEnd(id string, run meshwants.StepRun, started *time.Time, o stepOutcome, again string) {
ended := c.now().UTC()
if started == nil {
started = &ended
}
end := meshwants.StepEnded{V: 1, ID: id, Pipeline: run.Pipeline, Step: meshwants.StepEndedStepComposition, Module: run.Module,
Commit: run.Commit, Fingerprint: run.Fingerprint, Node: c.node, Outcome: o.Outcome, Said: o.Said, Warnings: o.Warnings,
Rerun: run.Rerun, By: run.By, Started: started, Ended: &ended, Shared: o.Shared}
msgID := id
if again != "" {
msgID = id + "." + again
}
if err := c.say(meshwants.EventStepEnded+"."+c.node, end, msgID); err != nil {
c.logf("saying the end of the composition step %s: %v", id, err)
return
}
if c.ended != nil {
c.ended(id, run, ended)
}
}
// move says the end again of each reader a rerun carried into an ended run, marked rerun (§727, A-470d): its machines judged
// from the candidate's keys naming it, the run's new ask in `shared`. A reader running here says its own end.
func (c *compositionSteps) move(ctx context.Context) func(run meshwants.CompositionRun) {
return func(run meshwants.CompositionRun) {
for _, reader := range run.Readers {
if !reader.Rerun || c.running(reader.ID) {
continue
}
c.logf("the composition step %s of %s moves with the composition run of %s (ask %s)", reader.ID, reader.Pipeline, run.Machine, run.Ask)
go c.say1(ctx, reader.ID, stepRunOf(reader), c.resume, run.Ask) // said again under the moved run's ask (A-470q)
}
}
}
// running is whether the step asked under id runs here.
func (c *compositionSteps) running(id string) bool {
c.mu.Lock()
defer c.mu.Unlock()
return c.stops[id] != nil
}
// leave ends the waits of the steps asked under ids (§723: a superseded or cancelled step leaves its runs).
func (c *compositionSteps) leave(ids []string) {
c.mu.Lock()
defer c.mu.Unlock()
for _, id := range ids {
if stop := c.stops[id]; stop != nil {
stop()
}
}
}
// sayProgress says the step's progress on the seat's step-progress.<node> once a minute until the returned stop is called (design
// 47 G §496, A-262): a ticker inside the running step, as the build seats' step runner says its own beat.
func (c *compositionSteps) sayProgress(id string, phase *stepPhase) (stop func()) {
ticks := c.ticks
if ticks == nil {
ticks = func(d time.Duration) (<-chan time.Time, func()) { t := time.NewTicker(d); return t.C, t.Stop }
}
tick, stopTicks := ticks(progressEvery)
done := make(chan struct{})
ended := make(chan struct{})
go func() {
defer close(ended)
defer stopTicks()
for {
select {
case <-done:
return
case <-tick:
at := c.now().UTC()
p := meshwants.StepProgressEvent{Ask: id, Asker: c.asker(), Phase: phase.get(), At: at, Shared: phase.waitsOn()}
if err := c.say(meshwants.EventStepProgress+"."+c.node, p, id+".progress."+at.Format(time.RFC3339Nano)); err != nil {
c.logf("saying the progress of the composition step %s: %v", id, err)
}
}
}
}()
return func() { close(done); <-ended }
}
// stepAskID is an ask's id as the asker names it: its event id, else its message id.
func stepAskID(m *nats.Msg) string {
if id := m.Header.Get("x-event-id"); id != "" {
return id
}
return m.Header.Get(nats.MsgIdHdr)
}
// serveCompositionSteps hears the composition step asks on the seat mesh-wants' accept subject.
func serveCompositionSteps(ctx context.Context, conn process.Subscriber, c *compositionSteps) error {
sub, err := conn.Subscribe(meshwants.AcceptSubjectStep, func(m *nats.Msg) { c.take(ctx, stepAskID(m), m.Data) })
if err != nil {
return err
}
go func() { <-ctx.Done(); _ = sub.Drain() }()
return nil
}
@@ -0,0 +1,243 @@
//go:build integration
package main
import (
"bytes"
"encoding/json"
"strings"
"testing"
"time"
"github.com/nats-io/nats.go"
"github.com/nats-io/nats.go/jetstream"
"git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient/enginereads"
"git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
"git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshwatchdogs"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/nodebuildgo"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/composer"
"git.novox.be/novox/mesh-sdk/go/buscalls"
"mesh-delivery-assigner/internal/buckets"
)
// Design 47 G §354, §22, §63, §64, §389, A-240, A-252, A-254: the assigner started whole takes the runner's composition step of a
// module placed on three machines, one of them away: it asks the two others' node-engines for their inputs, puts one run ask per
// machine on the Go build seat's check queue under its name, its program the node-engine build each machine runs; the stand-in
// build seat reads each request by the seat mesh-wants' verb input in chunks and says its step-ended with the composer's verdict;
// the step's step-ended fails naming the machine that does not compose, warns of the machine away, and no input stays kept.
func TestTheCompositionStepComposesEachMachineThroughTheBuildSeat(t *testing.T) {
b := startBed(t, "")
nc, err := nats.Connect(b.srv.ClientURL())
if err != nil {
t.Fatal(err)
}
t.Cleanup(nc.Close)
const engineCommit = "1111111111111111111111111111111111111111"
// The assigner's durable on EVENTS hears, beside the bed's, the build seat's step-ended and the watchman's machine-away and
// machine-back, as the grants part derives them from its consumes; what each node runs it hears on its kept stream (the bed's).
if _, err := b.js.CreateOrUpdateConsumer(b.ctx, "EVENTS", jetstream.ConsumerConfig{Durable: "n1_mesh-delivery-assigner",
FilterSubjects: []string{enginereads.SubjectPrefix + "*", "mesh.mod." + buckets.IndexerModule + ".event.views.>", meshcatalog.SubjectCatalogRevisionAll,
nodebuildgo.SubjectStepEndedAll, meshwatchdogs.SubjectMachineAwayAll, meshwatchdogs.SubjectMachineBackAll}, AckPolicy: jetstream.AckExplicitPolicy}); err != nil {
t.Fatal(err)
}
for _, node := range []string{"n1", "n2"} {
raw, _ := json.Marshal(nodeengine.Running{V: 1, Node: node, Module: "engine", Fingerprint: "src2:e1", At: time.Now().UTC()})
if _, err := b.js.Publish(b.ctx, nodeengine.SubjectRunning(node, "engine"), raw); err != nil {
t.Fatal(err)
}
}
awaitKept(t, b, nodeengine.StreamRunning, 2)
away, _ := json.Marshal(meshwatchdogs.MachineAwayEvent{V: 1, Machine: "n3", At: time.Now().UTC(), LastHeard: time.Now().UTC()})
if _, err := b.js.Publish(b.ctx, meshwatchdogs.SubjectMachineAway("n3"), away); err != nil {
t.Fatal(err)
}
// The trunk's catalog half holds the module and the node-engine, the module claiming the seat node-engine.
engine := meshcatalog.CatalogEntry{Module: "engine", Fp: "src2:e1", Repository: "novox/mesh-host", Commit: engineCommit, Path: ".",
Serves: []string{nodeengine.Seat + ".composition"}, Manifest: map[string]any{"module": "engine", "version": "0.1"}}
b.cat.mu.Lock()
b.cat.entries[trunkBranch] = map[string]meshcatalog.CatalogEntry{"engine": engine,
"m": {Module: "m", Fp: "src2:m1", Repository: "novox/m", Commit: engineCommit, Path: ".", Manifest: map[string]any{"module": "m", "version": "0.1"}}}
b.cat.rev[trunkBranch] = 3
b.cat.mu.Unlock()
for _, node := range []string{"n1", "n2", "n3"} {
b.place(t, node, "m")
}
// The node-engines of n1 and n2 answer compose-candidate with their inputs; n3 is never asked.
asked := make(chan string, 8)
engines, err := nc.Subscribe("mesh.seat.node-engine.call.compose-candidate.*.*", func(m *nats.Msg) {
node := strings.Split(m.Subject, ".")[5]
asked <- node
raw, _ := json.Marshal(map[string]any{"result": map[string]any{"candidate": "main.3", "node": node, "verdict": "composed", "input": map[string]any{"node": node},
"modules": []any{}, "own": map[string]any{}, "took": 1, "v": 1}, "node": node})
_ = m.Respond(raw)
})
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { _ = engines.Unsubscribe() })
// mesh-catalog's entry answers the node-engine build's entry by its fingerprint.
entries, err := nc.Subscribe("mesh.seat.mesh-catalog.call.entry.*", func(m *nats.Msg) {
raw, _ := json.Marshal(map[string]any{"result": meshcatalog.EntryAnswer{Entry: engine}, "node": "n0"})
_ = m.Respond(raw)
})
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { _ = entries.Unsubscribe() })
subscribed(t, nc)
// The runner hears the step's end.
ended := make(chan meshwants.StepEnded, 1)
ends, err := nc.Subscribe("mesh.seat.mesh-wants.event.step-ended.n1", func(m *nats.Msg) {
var e meshwants.StepEnded
_ = json.Unmarshal(m.Data, &e)
ended <- e
})
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { _ = ends.Unsubscribe() })
subscribed(t, nc)
from := b.journal.mark()
b.start(t)
b.journal.await(t, from, "the composition step is heard on", "the composition step served", 30*time.Second)
b.journal.await(t, from, "n3 is away (machine-away)", "the machine-away of n3 heard", 30*time.Second)
select {
case <-b.seatListRead: // the seat server admits a caller of input once the seat list is read (A-278)
case <-time.After(30 * time.Second):
t.Fatal("the assigner did not read the seat list within 30 s")
}
step, _ := json.Marshal(meshwants.StepRun{Pipeline: "main.3.m", Step: meshwants.StepRunStepComposition, Module: "m", Branch: trunkBranch,
Revision: 3, Commit: engineCommit, Fingerprint: "src2:m1"})
msg := nats.NewMsg(meshwants.AcceptSubjectStep)
msg.Header.Set("x-event-id", "step-ask-1")
msg.Data = step
if err := nc.PublishMsg(msg); err != nil {
t.Fatal(err)
}
// The stand-in Go build seat takes the run asks put under the assigner's name, reads each request by the verb input and says
// its end with the composer's verdict: n1 composes, n2 does not.
queue, _ := buildstep.AskStream(buildstep.AskGo)
// A-163: the assigner asks under its seat's own name.
subject := "mesh.seat.node-build-go.accept.check.mesh-wants"
worker, err := b.js.CreateOrUpdateConsumer(b.ctx, queue, jetstream.ConsumerConfig{Durable: "stand-in", FilterSubject: subject, AckPolicy: jetstream.AckExplicitPolicy})
if err != nil {
t.Fatal(err)
}
programs := map[string]string{}
for range 2 {
got, err := worker.Next(jetstream.FetchMaxWait(30 * time.Second))
if err != nil {
t.Fatalf("no run ask is put: %v", err)
}
_ = got.Ack()
a, err := buildstep.DecodeStepAsk(got.Data())
if err != nil || a.Run == nil {
t.Fatalf("the run ask %s does not read: %v", got.Data(), err)
}
req, err := composer.Decode(readInput(t, nc, a.Run.Input))
if err != nil || len(req.Machines) != 1 {
t.Fatalf("the request of %s: %+v %v", a.ID, req, err)
}
if len(req.Seats) == 0 { // the revision names no definition: the request carries the trunk seat list's (A-467)
t.Errorf("the request of %s carries no seat definition", a.ID)
}
node := req.Machines[0]
programs[node] = a.Run.Program.Commit
m := composer.Machine{Composes: true}
if node == "n2" {
m = composer.Machine{Reason: "two modules own one path", Problems: []string{"/etc/x"}}
}
v, _ := json.Marshal(composer.Verdict{V: composer.Version, Cases: []composer.CaseVerdict{{Name: changeCase, Machines: map[string]composer.Machine{node: m}}}})
end, _ := json.Marshal(buildstep.StepEnded{V: 1, ID: a.ID, Ask: a.ID, Asker: runAsker, Node: "b1", Outcome: buildstep.OutcomePassed, Output: string(v), At: time.Now().UTC()})
if _, err := b.js.Publish(b.ctx, nodebuildgo.SubjectStepEnded("b1"), end); err != nil {
t.Fatal(err)
}
}
var e meshwants.StepEnded
select {
case e = <-ended:
case <-b.ctx.Done():
t.Fatal("the composition step said no end")
}
if e.ID != "step-ask-1" || e.Outcome != meshwants.StepEndedOutcomeFailed || !strings.Contains(e.Said, "n2 does not compose") ||
strings.Contains(e.Said, "n1") || len(e.Warnings) != 2 || !strings.Contains(e.Warnings[0], "n3 is away") ||
e.Warnings[1] != "n2: the composer names no culprits" {
t.Fatalf("the step ended %+v", e)
}
if programs["n1"] != engineCommit || programs["n2"] != engineCommit {
t.Errorf("the composers were built at %v, want the node-engine build each machine runs", programs)
}
close(asked)
for node := range asked {
if node == "n3" {
t.Error("the machine away was asked for its input")
}
}
// The run's end comes before the input's delete (A-470o, A-470p): the inputs go after the step's end, heard by their watch.
inputs := b.buckets[buckets.Inputs()]
w, err := inputs.WatchAll(b.ctx)
if err != nil {
t.Fatal(err)
}
defer func() { _ = w.Stop() }()
deadline := time.After(10 * time.Second)
for {
keys, _ := inputs.Keys(b.ctx)
if len(keys) == 0 {
break
}
select {
case <-w.Updates():
case <-deadline:
t.Fatalf("the inputs stay kept past their step-ended: %v", keys)
}
}
}
// readInput reads a run's input as a build seat does: the seat mesh-wants' verb input answers its digest and chunk count, then its
// chunks on the call's subjects, each acknowledged.
func readInput(t *testing.T, nc *nats.Conn, in buildstep.RunInput) []byte {
t.Helper()
call := "standin" + strings.Repeat("0", 16)
chunks := buscalls.SeatChunks{Seat: meshwants.Seat, Verb: meshwants.VerbInput, Call: call}
sub, err := nc.SubscribeSync(chunks.Chunks())
if err != nil {
t.Fatal(err)
}
defer sub.Unsubscribe()
body, _ := json.Marshal(meshwants.InputInput{Digest: in.Digest, Call: call})
// On the call's subject naming its caller, the stand-in build seat's account: the seat server admits no unproven caller (A-179).
reply, err := nc.Request("mesh.seat.mesh-wants.call.input.n1~mesh-build-go", body, 10*time.Second)
if err != nil {
t.Fatal(err)
}
raw, said, ok := buscalls.Unwrap(reply.Data)
var a meshwants.InputAnswer
if !ok || json.Unmarshal(raw, &a) != nil || a.Chunks < 1 {
t.Fatalf("the verb input answered %s: %s", reply.Data, said)
}
var out bytes.Buffer
next := func() (string, []byte, error) {
m, err := sub.NextMsg(buscalls.SeatAckWithin)
if err != nil {
return "", nil, err
}
return m.Subject, m.Data, nil
}
ack := func(subject string) error { _, err := nc.Request(subject, nil, 10*time.Second); return err }
if _, err := chunks.Receive(a.Chunks, next, ack, &out); err != nil {
t.Fatal(err)
}
if err := in.Verify(out.Bytes()); err != nil {
t.Fatal(err)
}
return out.Bytes()
}
@@ -0,0 +1,210 @@
package main
import (
"context"
"encoding/json"
"git.novox.be/novox/mesh-sdk/go/seatdef"
"slices"
"strings"
"sync"
"testing"
"time"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
)
// saidEvents keeps what a publisher says.
type saidEvents struct {
mu sync.Mutex
said map[string]any
ids map[string]string
heard chan string
}
func newSaidEvents() *saidEvents {
return &saidEvents{said: map[string]any{}, ids: map[string]string{}, heard: make(chan string, 8)}
}
func (s *saidEvents) say(event string, body any, id string) error {
s.mu.Lock()
s.said[event], s.ids[event] = body, id
s.mu.Unlock()
s.heard <- event
return nil
}
// AS5 (§22, §354): the assigner takes mesh-wants' accepted kind `step` for the composition step and says the seat's
// step-ended.<node> with the ask's id, what the step was asked at and what it came to; an ask of another step is left.
func TestTheCompositionStepIsTakenAndItsEndSaid(t *testing.T) {
said := newSaidEvents()
at := time.Date(2026, 11, 12, 9, 0, 0, 0, time.UTC)
var asked meshwants.StepRun
c := &compositionSteps{node: "n1", say: said.say, now: func() time.Time { return at }, logf: t.Logf,
run: func(_ context.Context, id string, run meshwants.StepRun) stepOutcome {
asked = run
return stepOutcome{Outcome: meshwants.StepEndedOutcomeFailed, Said: "a and b own /etc/x", Warnings: []string{"n3 asleep"},
Shared: []meshwants.Shared{{Machine: "n1", Run: "main=2e4.n1", Ask: "run-1"}}}
}}
other, _ := json.Marshal(map[string]any{"pipeline": "main.4.m", "step": "build", "module": "m"})
if c.take(context.Background(), "ask-0", other) {
t.Fatal("a step ask of another step is taken")
}
body, _ := json.Marshal(meshwants.StepRun{Pipeline: "main.4.m", Step: meshwants.StepRunStepComposition, Module: "m", Branch: "main",
Commit: "c0ffee", Revision: 4, Fingerprint: "fp1", Rerun: true, By: "lead@n1"})
if c.take(context.Background(), "", body) {
t.Fatal("a step ask with no id is taken")
}
if !c.take(context.Background(), "ask-1", body) {
t.Fatal("the composition step is not taken")
}
select {
case <-said.heard:
case <-time.After(5 * time.Second):
t.Fatal("no step-ended is said")
}
event := meshwants.EventStepEnded + ".n1"
end, ok := said.said[event].(meshwants.StepEnded)
if !ok || said.ids[event] != "ask-1" {
t.Fatalf("said %v under %v, want step-ended.n1 under the ask's id", said.said, said.ids)
}
if asked.Module != "m" || end.ID != "ask-1" || end.Pipeline != "main.4.m" || end.Step != meshwants.StepEndedStepComposition ||
end.Module != "m" || end.Commit != "c0ffee" || end.Fingerprint != "fp1" || end.Node != "n1" ||
end.Outcome != meshwants.StepEndedOutcomeFailed || end.Said != "a and b own /etc/x" || len(end.Warnings) != 1 ||
!end.Rerun || end.By != "lead@n1" || end.Started == nil || end.Ended == nil ||
len(end.Shared) != 1 || end.Shared[0] != (meshwants.Shared{Machine: "n1", Run: "main=2e4.n1", Ask: "run-1"}) { // §723, §729
t.Fatalf("step-ended %+v", end)
}
}
// Design 47 G §496, A-262: a running composition step says step-progress.<node> on every tick of its ticker, with the ask, its
// asker, the phase the run is in and the time, and says none once it has ended.
func TestARunningCompositionStepSaysItsProgress(t *testing.T) {
said := newSaidEvents()
tick := make(chan time.Time)
stopped := make(chan struct{})
at := time.Date(2026, 11, 12, 9, 0, 0, 0, time.UTC)
release := make(chan struct{})
// A-294: the asker is the one caller mesh-wants' definition lists for step, read from the seat list; none while unread
// or while it lists more than one.
runner := seatdef.Definition{Seat: meshwants.Seat, Accepts: []seatdef.Message{{Name: meshwants.AcceptStep,
Callers: &seatdef.Callers{List: []string{"seat:mesh-pipeline-runner"}}}}}
two := seatdef.Definition{Seat: meshwants.Seat, Accepts: []seatdef.Message{{Name: meshwants.AcceptStep,
Callers: &seatdef.Callers{List: []string{"seat:mesh-pipeline-runner", "seat:mesh-catalog"}}}}}
for _, d := range []struct {
def seatdef.Definition
read bool
want string
}{{runner, true, "mesh-pipeline-runner"}, {runner, false, ""}, {two, true, ""}} {
if got := stepAskerOf(func() (seatdef.Definition, bool) { return d.def, d.read })(); got != d.want {
t.Errorf("the asker of %+v (read %v) = %q, want %q", d.def.Accepts, d.read, got, d.want)
}
}
c := &compositionSteps{node: "n1", say: said.say, now: func() time.Time { return at }, logf: t.Logf,
asker: stepAskerOf(func() (seatdef.Definition, bool) { return runner, true }),
ticks: func(d time.Duration) (<-chan time.Time, func()) {
if d != time.Minute {
t.Errorf("the progress ticks every %s, want a minute", d)
}
return tick, func() { close(stopped) }
},
run: func(ctx context.Context, _ string, _ meshwants.StepRun) stepOutcome {
setPhase(ctx, meshwants.StepProgressEventPhaseRun)
setShared(ctx, []meshwants.Shared{{Machine: "n1", Run: "main=2e4.n1", Ask: "run-1"}})
<-release
return stepOutcome{Outcome: meshwants.StepEndedOutcomePassed}
}}
body, _ := json.Marshal(meshwants.StepRun{Pipeline: "main.4.m", Step: meshwants.StepRunStepComposition, Module: "m", Branch: "main"})
if !c.take(context.Background(), "ask-1", body) {
t.Fatal("the composition step is not taken")
}
progress := meshwants.EventStepProgress + ".n1"
for range 2 {
tick <- at
if e := <-said.heard; e != progress {
t.Fatalf("said %s on a tick, want %s", e, progress)
}
}
said.mu.Lock()
p, ok := said.said[progress].(meshwants.StepProgressEvent)
said.mu.Unlock()
if !ok || p.Ask != "ask-1" || p.Asker != "mesh-pipeline-runner" || p.Phase != meshwants.StepProgressEventPhaseRun || !p.At.Equal(at) ||
len(p.Shared) != 1 || p.Shared[0].Ask != "run-1" { // the runs the step waits on (§723)
t.Fatalf("step-progress %+v", p)
}
close(release)
if e := <-said.heard; e != meshwants.EventStepEnded+".n1" {
t.Fatalf("said %s at the end, want step-ended", e)
}
select {
case <-stopped:
default:
t.Fatal("the ticker is not stopped when the step has ended")
}
}
// Design 47 G §723, A-469n, A-469z: a superseded or cancelled pipeline's composition step leaves the runs it reads and says no end;
// a run another pipeline's step reads goes on for it; a run left with no reader has its ask dropped and ends could not run, "no
// reader is left", so a later step starts a new run.
func TestASupersededStepLeavesItsRuns(t *testing.T) {
now := time.Date(2026, 11, 17, 12, 0, 0, 0, time.UTC)
r := newCompositionRuns(newRunsMem(), defaultRunSettings, func() time.Time { return now }, t.Logf)
var drops []string
r.drop = func(ask, why string) error { drops = append(drops, ask+": "+why); return nil }
step := func(pipeline string) meshwants.StepRun {
return meshwants.StepRun{Pipeline: pipeline, Step: meshwants.StepRunStepComposition, Module: pipeline, Branch: "main", Revision: 3}
}
said := newSaidEvents()
c := &compositionSteps{node: "n1", say: said.say, now: func() time.Time { return now }, logf: t.Logf,
run: func(ctx context.Context, id string, s meshwants.StepRun) stepOutcome {
j, err := r.join(readerOf(id, s), "main.3", "n1", "run-"+id)
if err != nil {
t.Error(err)
}
r.await(ctx, []string{j.key})
return stepOutcome{Outcome: meshwants.StepEndedOutcomePassed}
}}
body := func(s meshwants.StepRun) []byte { raw, _ := json.Marshal(s); return raw }
for _, p := range []string{"main.3.a", "main.3.b"} {
if !c.take(context.Background(), "ask-"+p, body(step(p))) {
t.Fatal("not taken")
}
}
key := runKeyOf("main.3", "n1")
for {
wake := r.wake()
if run, _, _, _ := r.read(key); len(run.Readers) == 2 {
break
}
<-wake
}
ids, err := r.leave("main.3.a", c.leave)
run, _, _, _ := r.read(key)
if err != nil || !slices.Equal(ids, []string{"ask-main.3.a"}) || run.Ended != nil || len(run.Readers) != 1 || len(drops) != 0 {
t.Fatalf("after a's supersede: %v %v, run %+v, drops %v: want the run going on for b", ids, err, run, drops)
}
_, err = r.leave("main.3.b", c.leave)
run, _, _, _ = r.read(key)
if err != nil || run.Outcome != meshwants.CompositionRunOutcomeCouldNotRun || !strings.Contains(run.Said, "no reader is left") || len(drops) != 1 ||
!strings.HasPrefix(drops[0], run.Ask+": no reader is left") {
t.Fatalf("after b's supersede: %v, run %+v, drops %v", err, run, drops)
}
deadline := time.After(5 * time.Second)
for {
c.mu.Lock()
n := len(c.stops)
c.mu.Unlock()
if n == 0 {
break
}
select {
case <-deadline:
t.Fatal("the steps that left still wait")
case <-time.After(time.Millisecond):
}
}
said.mu.Lock()
defer said.mu.Unlock()
if _, ok := said.said[meshwants.EventStepEnded+".n1"]; ok {
t.Errorf("a step that left says its end: %v", said.said)
}
}
@@ -0,0 +1,454 @@
package main
import (
"context"
"encoding/json"
"fmt"
"slices"
"sort"
"strings"
"sync"
"time"
"github.com/nats-io/nats.go/jetstream"
wd "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshwatchdogs"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-sdk/go/keys"
"git.novox.be/novox/mesh-sdk/go/process"
"mesh-delivery-assigner/internal/assign"
"mesh-delivery-assigner/internal/assignment"
"mesh-delivery-assigner/internal/buckets"
)
// A delivery is waited for mesh-wide (design 47 G §376, §389, A-189, A-246). At its start the assigner reads whole, from their first
// message, the streams of the catalog seat's version-released and of its own version-delivered (mesh-sdk process.FromFirst, A-233),
// and the watchman's machine-away and machine-back, never its state; then it hears them. A released version of a module is said
// version-delivered on the seat mesh-wants once, when every present machine placing it on the branch it is released from runs, healthy,
// the want the assigner wrote naming that version; a version no present machine places is not delivered. A dependent whose want
// changes fingerprint waits, by an edge of kind 2, 4 or 6, for its dependency's newest released version not yet said delivered, on
// the branch it is released from; on another branch no version is released and nothing waits. The wait is said wait-held, step
// delivery, bound 60 minutes from the version's release, kept in the state delivery-waits under the dependent's name, and said
// wait-ended when the version is delivered (ran) or released by hand (assigner_release, released).
// deliveryWaitBound is a dependent's delivery wait's bound, from its dependency's version-released.
const deliveryWaitBound = 60 * time.Minute
// Wait-ended's how of a delivery wait.
const (
deliveryWaitRan = "ran"
deliveryWaitReleased = "released"
)
// releaseHeard is one version-released heard: the version, each part's digest, the source revision and when it was said.
type releaseHeard struct {
Version string
Parts map[string]string
Source int64
At time.Time
}
// newestOf is the newest version of module released, the last heard of it in the stream's order.
func (r *releasedVersions) newestOf(module string) (releaseHeard, bool) {
r.mu.Lock()
defer r.mu.Unlock()
h, ok := r.newest[module]
return h, ok
}
// deliveredVersions are the version-delivered said, the assigner's own, by module and version: each is said once.
type deliveredVersions struct {
mu sync.Mutex
said map[string]bool
}
func (d *deliveredVersions) key(module, version string) string { return module + "@" + version }
// put takes one version-delivered in.
func (d *deliveredVersions) put(data []byte) error {
var e meshwants.VersionDeliveredEvent
if err := json.Unmarshal(data, &e); err != nil {
return fmt.Errorf("a version-delivered that is none: %w", err)
}
if e.Module == "" || e.Version == "" {
return fmt.Errorf("a version-delivered naming no module or version: %s", data)
}
d.mark(e.Module, e.Version)
return nil
}
func (d *deliveredVersions) mark(module, version string) {
d.mu.Lock()
defer d.mu.Unlock()
if d.said == nil {
d.said = map[string]bool{}
}
d.said[d.key(module, version)] = true
}
// has says whether version-delivered of module's version was said.
func (d *deliveredVersions) has(module, version string) bool {
d.mu.Lock()
defer d.mu.Unlock()
return d.said[d.key(module, version)]
}
// presenceOf reads one machine-away or machine-back: the machine and when it was said.
func presenceOf(data []byte) (string, time.Time, error) {
var e wd.MachineAwayEvent // machine-back has the same fields
if err := json.Unmarshal(data, &e); err != nil {
return "", time.Time{}, err
}
if e.Machine == "" {
return "", time.Time{}, fmt.Errorf("it names no machine: %s", data)
}
return e.Machine, e.At, nil
}
// hearDelivery reads whole, then follows, the four streams a delivery is judged from: version-released, version-delivered,
// machine-away and machine-back. A stream not heard is said as the assigner's finding, and what it carries is not known until
// the assigner starts again.
func hearDelivery(ctx context.Context, js jetstream.JetStream, w *world, wake func(), findings assign.Findings, logf func(string, ...any)) {
acct := process.Account{Node: thisNode, Module: assignment.Module()}
nh := notHeardWriter(findings, logf)
for _, s := range []struct {
stream, words string
take func([]byte) error
}{
{meshcatalog.StreamVersionReleased, "no want names a released version and no delivery is judged", w.released.put},
{meshwants.StreamVersionDelivered, "a version said delivered before is said again once it is judged", w.delivered.put},
{wd.StreamMachineAway, "no machine is known away, so a delivery waits for a machine that is away", func(data []byte) error {
m, at, err := presenceOf(data)
if err == nil {
w.heardPresence(m, true, at)
logf("%s is away (machine-away): a composition step does not compose it until its machine-back", m)
}
return err
}},
{wd.StreamMachineBack, "a machine once away is not known back", func(data []byte) error {
m, at, err := presenceOf(data)
if err == nil {
w.heardPresence(m, false, at)
logf("%s is back (machine-back): a composition step composes it again", m)
}
return err
}},
} {
take := s.take
cc, err := acct.HearSeatEvents(ctx, js, s.stream, func(m jetstream.Msg) {
if err := take(m.Data()); err != nil {
logf("%s is not kept: %v", m.Subject(), err)
}
if err := m.Ack(); err != nil {
logf("acknowledging %s: %v", m.Subject(), err)
}
wake()
}, logf, process.FromFirst())
if err != nil {
nh.NotHeard(s.stream, s.words+" until the assigner starts again", err)
continue
}
nh.Heard(s.stream)
go func() {
<-ctx.Done()
cc.Stop()
}()
}
}
// releaseBranch is the branch module's versions are released from: the first watched branch of its registration (§371).
func (p *passer) releaseBranch(module string) string {
if p.ends.following() {
return p.ends.branchOf(module, "")
}
return p.w.trunkName()
}
// placing is every machine placing module on the branch its versions are released from, sorted.
func (p *passer) placing(module string) []string {
branch := p.releaseBranch(module)
var out []string
for node, placed := range p.w.placedBranches()[module] {
if p.ends.following() {
placed = p.ends.branchOf(module, placed)
} else {
placed = p.w.trunkName() // the trunk-only form: every placement runs the trunk's
}
if placed == branch {
out = append(out, node)
}
}
sort.Strings(out)
return out
}
// deliveryStanding is where module's version stands: the present placing machines not yet running it healthy as its want names
// it, and the placing machines away.
func (p *passer) deliveryStanding(module, version string) (notRunning, away []string, placing int) {
gone := p.w.awayNow()
n := assign.Nodes{Running: p.w.runningNow()}
wanted := p.w.wantsOf()[module]
nodes := p.placing(module)
for _, node := range nodes {
if gone[node] {
away = append(away, node)
continue
}
want, ok := wanted[node]
if !ok || want.Removed || want.Version != version || !n.RunsHealthy(node, module, want.Fp) {
notRunning = append(notRunning, node)
}
}
return notRunning, away, len(nodes)
}
// judgeDelivered says version-delivered of each module's newest released version not said yet, once every present machine placing
// it runs it healthy; judged again at each pass, which each running, machine-away, machine-back and placement change wakes.
func (p *passer) judgeDelivered() {
for _, module := range p.releasedModules() {
rel, _ := p.w.released.newestOf(module)
if p.w.delivered.has(module, rel.Version) {
continue
}
notRunning, away, placing := p.deliveryStanding(module, rel.Version)
if placing == 0 || len(away) == placing || len(notRunning) > 0 {
continue
}
if err := p.sayDelivered(module, rel, away); err != nil {
p.logf("version-delivered of %s %s is not said, and is judged again at the next pass: %v", module, rel.Version, err)
}
}
}
// sayDelivered says version-delivered of module's release rel, with the machines away, and keeps it said.
func (p *passer) sayDelivered(module string, rel releaseHeard, away []string) error {
at := p.clock().UTC()
body := meshwants.VersionDeliveredEvent{V: keys.Version, Module: module, Version: rel.Version, Parts: rel.Parts, Away: away, At: &at}
if err := p.wantsSay(meshwants.EventVersionDelivered, body, fmt.Sprintf("%s.%s.%s.%s", meshwants.EventVersionDelivered, module, rel.Version, at.Format(time.RFC3339Nano))); err != nil {
return err
}
p.w.delivered.mark(module, rel.Version)
return nil
}
// releasedModules is every module a version-released was heard of, sorted.
func (p *passer) releasedModules() []string {
r := &p.w.released
r.mu.Lock()
defer r.mu.Unlock()
out := make([]string, 0, len(r.newest))
for m := range r.newest {
out = append(out, m)
}
sort.Strings(out)
return out
}
// deliveryWait is what a dependent waits for: its dependency, the version and the machines not yet running it.
type deliveryWait struct {
dependency string
rel releaseHeard
notRunning []string
away []string
}
// waitsForDelivery says whether module, whose want on its nodes changes to fp on branch, waits for a dependency's delivery: by
// each edge of kind 2, 4 or 6 into it in branch's catalog half, the dependency's newest released version on branch not yet said
// delivered. A want that changes no fingerprint waits for nothing; on a branch no version is released from, nothing waits.
func (p *passer) waitsForDelivery(module, fp, branch string, nodes []string) (deliveryWait, bool) {
wanted := p.w.wantsOf()[module]
changes := false
for _, node := range nodes {
if w, ok := wanted[node]; !ok || w.Removed || w.Fp != fp {
changes = true
}
}
if !changes || fp == "" {
return deliveryWait{}, false
}
var deps []string
for _, e := range p.w.edgesOf(branch, module) {
if e.Kind != 2 && e.Kind != 4 && e.Kind != 6 {
continue
}
dep, _, _ := strings.Cut(e.From, ":")
if dep != "" && dep != module && !slices.Contains(deps, dep) {
deps = append(deps, dep)
}
}
sort.Strings(deps)
for _, dep := range deps {
if p.releaseBranch(dep) != branch {
continue
}
rel, ok := p.w.released.newestOf(dep)
if !ok || p.w.delivered.has(dep, rel.Version) {
continue
}
notRunning, away, _ := p.deliveryStanding(dep, rel.Version)
return deliveryWait{dependency: dep, rel: rel, notRunning: notRunning, away: away}, true
}
return deliveryWait{}, false
}
// words is a delivery wait in plain words, as assigner_why_not and the status view say it.
func (d deliveryWait) words() string {
if len(d.notRunning) == 0 && len(d.away) > 0 {
return fmt.Sprintf("waiting for %s to be back", strings.Join(d.away, ", "))
}
return fmt.Sprintf("waiting for delivery of %s %s on %s", d.dependency, d.rel.Version, strings.Join(d.notRunning, ", "))
}
// deliveryWaitBody is the wait-held of module's delivery wait d.
func deliveryWaitBody(module, fp string, d deliveryWait, since time.Time) meshwants.Wait {
from := d.rel.At.UTC()
if from.IsZero() {
from = since.UTC()
}
return meshwants.Wait{Step: meshwants.WaitStepDelivery, Owner: meshwants.Seat, Module: module, Version: fp, Part: d.dependency,
On: d.dependency + "@" + d.rel.Version, Machines: d.notRunning, Since: since.UTC(), ClockFrom: &from, Bound: deliveryWaitBound.String(),
Words: d.words()}
}
// deliveryWaiting is one delivery wait the state delivery-waits keeps, by its dependent's name: the wait-held said, and a release
// by hand written by assigner_release.
type deliveryWaiting struct {
meshwants.Wait
// Released is set by assigner_release: the wait ends released and the dependent's want is written.
Released bool `json:"released,omitempty"`
}
// saidDeliveryWaits is every delivery wait the state delivery-waits holds, by module; a value that does not decode is said and left.
func (p *passer) saidDeliveryWaits() map[string]deliveryWaiting {
out := map[string]deliveryWaiting{}
for key, value := range p.w.read(buckets.DeliveryWaits()) {
var w deliveryWaiting
if err := json.Unmarshal(value, &w); err != nil || w.Module == "" {
p.logf("%s %s holds no delivery wait, left: %v", buckets.DeliveryWaits(), key, err)
continue
}
out[w.Module] = w
}
return out
}
// holdForDelivery says whether module's want, changing to fp on branch, is held for a dependency's delivery this pass: it says
// wait-held once and keeps it; a wait released by hand holds nothing; a wait that no longer holds is ended ran.
func (p *passer) holdForDelivery(ctx context.Context, module, fp, branch string, nodes []string) bool {
if p.kvs[buckets.DeliveryWaits()] == nil {
return false
}
key := keys.EscapeName(module)
said, was := p.saidDeliveryWaits()[module]
d, waits := p.waitsForDelivery(module, fp, branch, nodes)
switch {
case was && said.Released:
p.endDeliveryWait(ctx, key, said, deliveryWaitReleased) // the want is written now, so it changes nothing at the next pass
return false
case !waits:
if was {
p.endDeliveryWait(ctx, key, said, deliveryWaitRan)
}
return false
}
body := deliveryWaitBody(module, fp, d, p.clock())
if was && said.On == body.On && said.Version == fp && slices.Equal(said.Machines, body.Machines) {
return true
}
if was {
body.Since = said.Since
}
id := fmt.Sprintf("%s.delivery.%s.%s.%s", key, fp, body.On, strings.Join(body.Machines, ","))
if err := p.wantsSay(meshwants.EventWaitHeld, body, id); err != nil {
p.logf("the delivery wait of %s is not said, and is said at the next pass: %v", module, err)
return true
}
kept := deliveryWaiting{Wait: body}
p.put(ctx, buckets.DeliveryWaits(), key, func() ([]byte, error) { return json.Marshal(kept) })
p.logf("%s at %s on %s waits for the delivery of its dependency %s on %s: the rules write no want of it until then (design 47 G §376)", module, shortHex(fp), branch, body.On, strings.Join(body.Machines, ", "))
return true
}
// endDeliveryWait says wait-ended of a delivery wait with how and removes it from the state.
func (p *passer) endDeliveryWait(ctx context.Context, key string, w deliveryWaiting, how string) {
body := w.Wait
body.How = how
if err := p.wantsSay(meshwants.EventWaitEnded, body, key+".delivery."+body.Version+"."+how); err != nil {
p.logf("the end of the delivery wait of %s is not said, and is said at the next pass: %v", w.Module, err)
return
}
p.remove(ctx, buckets.DeliveryWaits(), key)
}
// againAsk is one ask of assigner_delivered_again, kept in the state delivered-again under its module (A-250): the version to say
// delivered again, who asked and why, and, while it does not hold, why not.
type againAsk struct {
Module string `json:"module"`
Version string `json:"version"`
By string `json:"by"`
Why string `json:"why"`
Waits string `json:"waits,omitempty"`
}
// releaseOf is the release heard of module's version.
func (r *releasedVersions) releaseOf(module, version string) (releaseHeard, bool) {
r.mu.Lock()
defer r.mu.Unlock()
if h, ok := r.newest[module]; ok && h.Version == version {
return h, true
}
for key, k := range r.seen {
if strings.HasPrefix(key, module+"@") && k.Version == version {
return releaseHeard{Version: version, Parts: k.Parts}, true
}
}
return releaseHeard{}, false
}
// deliveredAgain takes each ask of assigner_delivered_again, heard at once through the watch of the state delivered-again: it says
// version-delivered again when every present machine placing the module runs that version healthy and removes the ask, else keeps
// it with why it does not hold, which assigner_waits reads.
func (p *passer) deliveredAgain(ctx context.Context) {
if p.kvs[buckets.DeliveredAgain()] == nil {
return
}
for key, value := range p.w.read(buckets.DeliveredAgain()) {
var a againAsk
if err := json.Unmarshal(value, &a); err != nil || a.Version == "" {
p.logf("%s %s holds no ask, left: %v", buckets.DeliveredAgain(), key, err)
continue
}
module := a.Module
if module == "" {
module = key
}
waits := ""
rel, ok := p.w.released.releaseOf(module, a.Version)
notRunning, away, placing := p.deliveryStanding(module, a.Version)
switch {
case !ok:
waits = fmt.Sprintf("no version-released of %s %s is heard", module, a.Version)
case placing == 0:
waits = fmt.Sprintf("no machine places %s", module)
case len(away) == placing:
waits = fmt.Sprintf("every machine placing %s is away: %s", module, strings.Join(away, ", "))
case len(notRunning) > 0:
waits = fmt.Sprintf("%s %s does not run healthy on %s", module, a.Version, strings.Join(notRunning, ", "))
}
if waits == "" {
if err := p.sayDelivered(module, rel, away); err != nil {
p.logf("version-delivered of %s %s asked again is not said, and is asked at the next pass: %v", module, a.Version, err)
continue
}
p.logf("version-delivered of %s %s said again, asked by %s: %s", module, a.Version, a.By, a.Why)
p.remove(ctx, buckets.DeliveredAgain(), key)
continue
}
if a.Waits != waits {
a.Waits = waits
p.put(ctx, buckets.DeliveredAgain(), key, func() ([]byte, error) { return json.Marshal(a) })
}
}
}
@@ -0,0 +1,188 @@
package main
import (
"context"
"encoding/json"
"strings"
"testing"
"time"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
mwc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshwantsclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"mesh-delivery-assigner/internal/buckets"
)
// Design 47 G §376, §389, §498, A-189, A-246: a released version is said version-delivered once, when every present machine placing
// it runs healthy the want naming it, a machine away named and not waited for, none when every placing machine is away; a dependent
// whose want changes fingerprint waits by an edge of kind 2, 4 or 6 for its dependency's newest released version not yet said
// delivered, said wait-held (step delivery, 60 minutes from the release) once and kept in delivery-waits, and wait-ended ran once
// the version is delivered; a kind-1 edge, or a dependency with no version released, waits for nothing; one released by hand ends
// released and its want is written.
func TestADependentWaitsForItsDependencysDelivery(t *testing.T) {
ctx := context.Background()
at := time.Date(2026, 11, 12, 9, 0, 0, 0, time.UTC)
waits := &memKV{values: map[string][]byte{}}
again := &memKV{values: map[string][]byte{}}
p := newPasser(kvSet{buckets.Wants(): &memKV{values: map[string][]byte{}}, buckets.DeliveryWaits(): waits, buckets.DeliveredAgain(): again}, at)
p.logf = t.Logf
var events []said
p.publishWants = func(event string, body any, id string) error {
raw, _ := json.Marshal(body)
events = append(events, said{event, id, raw})
return nil
}
p.w.runningHeard = true
placeOn(t, p.w, "ace", "db", "app")
placeOn(t, p.w, "g14", "db")
fp := func(c string) string { return meshcatalogclient.SourcePrefix2 + strings.Repeat(c, 64) }
want := func(node, module, fp, version string) {
key, _ := mwc.WantKey(node, module)
raw, err := mwc.EncodeWant(mwc.Want{Fp: fp, Version: version, Self: true})
if err != nil {
t.Fatal(err)
}
p.w.put(buckets.Wants(), key, raw)
}
runs := func(node, module, fp string) {
raw, _ := json.Marshal(map[string]any{"v": 1, "node": node, "module": module, "fingerprint": fp, "at": at})
if err := p.w.hearRunning("running", raw); err != nil {
t.Fatal(err)
}
}
source := int64(3)
release := func(module, version string) {
source++
raw, _ := json.Marshal(meshcatalog.VersionReleasedEvent{V: 1, Module: module, Version: version, Source: source, At: &at,
Artifacts: []meshcatalog.VersionArtifact{{Artifact: "program", Digest: "sha256:d"}}})
if err := p.w.released.put(raw); err != nil {
t.Fatal(err)
}
}
saidOf := func(event string) []said {
var out []said
for _, e := range events {
if e.event == event {
out = append(out, e)
}
}
return out
}
want("ace", "app", fp("1"), "")
// No version of db is released: app's new fingerprint waits for nothing.
p.w.putEdges(trunkBranch, "app", []meshcatalog.Edge{{Kind: 4, From: "db:program", To: "app:program"}})
if p.holdForDelivery(ctx, "app", fp("2"), trunkBranch, []string{"ace"}) {
t.Fatal("app waits with no version of db released")
}
release("db", "1.1.0")
want("ace", "db", fp("d"), "1.1.0")
want("g14", "db", fp("d"), "1.1.0")
runs("ace", "db", fp("d"))
// A kind-1 edge orders nothing.
p.w.putEdges(trunkBranch, "app", []meshcatalog.Edge{{Kind: 1, From: "db:program", To: "app:program"}})
if p.holdForDelivery(ctx, "app", fp("2"), trunkBranch, []string{"ace"}) {
t.Fatal("a kind-1 edge holds app")
}
p.w.putEdges(trunkBranch, "app", []meshcatalog.Edge{{Kind: 4, From: "db:program", To: "app:program"}})
// app's want unchanged waits for nothing.
if p.holdForDelivery(ctx, "app", fp("1"), trunkBranch, []string{"ace"}) {
t.Fatal("app's unchanged want waits")
}
// g14 places db and does not run 1.1.0 yet: not delivered, and app's new version waits, said once.
p.judgeDelivered()
if !p.holdForDelivery(ctx, "app", fp("2"), trunkBranch, []string{"ace"}) || !p.holdForDelivery(ctx, "app", fp("2"), trunkBranch, []string{"ace"}) {
t.Fatal("app does not wait for db 1.1.0")
}
if len(saidOf(meshwants.EventVersionDelivered)) != 0 {
t.Fatalf("db is said delivered while g14 does not run it: %+v", events)
}
held := saidOf(meshwants.EventWaitHeld)
if len(held) != 1 {
t.Fatalf("wait-held said %d times, want once", len(held))
}
var w meshwants.Wait
_ = json.Unmarshal(held[0].body, &w)
if w.Step != meshwants.WaitStepDelivery || w.Part != "db" || w.Module != "app" || w.Version != fp("2") || w.Bound != "1h0m0s" ||
w.ClockFrom == nil || !w.ClockFrom.Equal(at) || len(w.Machines) != 1 || w.Machines[0] != "g14" || w.Words != "waiting for delivery of db 1.1.0 on g14" {
t.Errorf("the wait said is %+v", w)
}
if _, ok := waits.values["app"]; !ok {
t.Errorf("the wait is not kept in delivery-waits: %v", waits.values)
}
// g14 away: every present machine runs it, so it is delivered, g14 named away; once only.
p.w.heardPresence("g14", true, at)
p.judgeDelivered()
p.judgeDelivered()
delivered := saidOf(meshwants.EventVersionDelivered)
var d meshwants.VersionDeliveredEvent
if len(delivered) != 1 || json.Unmarshal(delivered[0].body, &d) != nil || d.Module != "db" || d.Version != "1.1.0" ||
len(d.Away) != 1 || d.Away[0] != "g14" || d.Parts["db:program"] != "sha256:d" {
t.Fatalf("version-delivered said %+v", delivered)
}
// The wait ends ran, and app's want goes on.
if p.holdForDelivery(ctx, "app", fp("2"), trunkBranch, []string{"ace"}) {
t.Fatal("app still waits once db 1.1.0 is delivered")
}
ended := saidOf(meshwants.EventWaitEnded)
if len(ended) != 1 || json.Unmarshal(ended[0].body, &w) != nil || w.How != deliveryWaitRan {
t.Errorf("wait-ended said %+v", ended)
}
if _, ok := waits.values["app"]; ok {
t.Error("the ended wait is kept")
}
// A newer release with every placing machine away is not delivered, and its wait says the machines it waits to be back.
release("db", "1.2.0")
p.w.heardPresence("ace", true, at)
p.judgeDelivered()
if len(saidOf(meshwants.EventVersionDelivered)) != 1 {
t.Error("a version is said delivered while every placing machine is away")
}
if !p.holdForDelivery(ctx, "app", fp("3"), trunkBranch, []string{"ace"}) {
t.Fatal("app does not wait for db 1.2.0")
}
held = saidOf(meshwants.EventWaitHeld)
if json.Unmarshal(held[len(held)-1].body, &w) != nil || w.Words != "waiting for ace, g14 to be back" {
t.Errorf("the wait while every machine is away says %q", w.Words)
}
// Released by hand (assigner_release writes it): the wait ends released and app's want is written.
var kept deliveryWaiting
_ = json.Unmarshal(waits.values["app"], &kept)
kept.Released = true
raw, _ := json.Marshal(kept)
p.w.put(buckets.DeliveryWaits(), "app", raw)
if p.holdForDelivery(ctx, "app", fp("3"), trunkBranch, []string{"ace"}) {
t.Fatal("a released wait holds app")
}
ended = saidOf(meshwants.EventWaitEnded)
if json.Unmarshal(ended[len(ended)-1].body, &w) != nil || w.How != deliveryWaitReleased {
t.Errorf("the released wait ended %+v", w)
}
// Presence: the later of machine-away and machine-back holds, whichever stream is read first.
p.w.heardPresence("ace", false, at.Add(time.Minute))
p.w.heardPresence("ace", true, at)
if p.w.awayNow()["ace"] || !p.w.online()["ace"] {
t.Error("an older machine-away read after a newer machine-back leaves ace away")
}
// A-250: an ask of assigner_delivered_again of 1.1.0, which ace (present) runs and g14 (away) does not, is said again and taken
// away; one of 1.2.0, which no machine runs, is kept with why.
ask := func(version string) {
raw, _ := json.Marshal(againAsk{Module: "db", Version: version, By: "op", Why: "the catalog missed it"})
p.w.put(buckets.DeliveredAgain(), "db", raw)
}
before := len(saidOf(meshwants.EventVersionDelivered))
ask("1.1.0")
p.deliveredAgain(ctx)
if len(saidOf(meshwants.EventVersionDelivered)) != before+1 || p.w.has(buckets.DeliveredAgain(), "db") {
t.Errorf("the ask of 1.1.0 said %d version-delivered and is kept %v", len(saidOf(meshwants.EventVersionDelivered))-before, p.w.has(buckets.DeliveredAgain(), "db"))
}
ask("1.2.0")
p.deliveredAgain(ctx)
var a againAsk
if json.Unmarshal(p.w.value(buckets.DeliveredAgain(), "db"), &a) != nil || a.Waits != "db 1.2.0 does not run healthy on ace" ||
len(saidOf(meshwants.EventVersionDelivered)) != before+1 {
t.Errorf("the ask of 1.2.0 = %+v", a)
}
}
@@ -0,0 +1,82 @@
package main
import (
"context"
"encoding/json"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-sdk/go/busstate"
"mesh-delivery-assigner/internal/assigngraph"
)
// runtimeObjects is the kept data assignment-revisions as the bundle reaches it through its runtime (the old objects
// section of a foundation part, design 47 lines 1362-1366).
type runtimeObjects struct{ o busstate.Objects }
func (r runtimeObjects) Put(_ context.Context, name string, data []byte) error {
_, err := r.o.Put(name, data, "")
return err
}
func (r runtimeObjects) Get(_ context.Context, name string) ([]byte, error) {
d, err := r.o.Get(name)
if err != nil {
return nil, err
}
if d.Info.Name == "" || d.Info.Deleted {
return nil, assigngraph.ErrNoObject
}
return d.Data, nil
}
func (r runtimeObjects) Names(context.Context) ([]string, error) {
infos, err := r.o.List()
if err != nil {
return nil, err
}
names := []string{}
for _, i := range infos {
if !i.Deleted {
names = append(names, i.Name)
}
}
return names, nil
}
// graphVerbs are the seat mesh-wants' verbs revision, entry and difference (design 47 lines 1365-1366: an assignment graph
// revision is served by the seat's verbs), each reading only the kept revisions.
func graphVerbs(o assigngraph.Objects) map[string]func(map[string]any) (any, error) {
return map[string]func(map[string]any) (any, error){
meshwants.VerbRevision: func(a map[string]any) (any, error) {
var in meshwants.RevisionInput
if err := decodeArgs(a, &in); err != nil {
return nil, err
}
return assigngraph.Revision(context.Background(), o, in)
},
meshwants.VerbEntry: func(a map[string]any) (any, error) {
var in meshwants.EntryInput
if err := decodeArgs(a, &in); err != nil {
return nil, err
}
return assigngraph.Entry(context.Background(), o, in)
},
meshwants.VerbDifference: func(a map[string]any) (any, error) {
var in meshwants.DifferenceInput
if err := decodeArgs(a, &in); err != nil {
return nil, err
}
return assigngraph.Difference(context.Background(), o, in)
},
}
}
// decodeArgs reads a verb's arguments into its input type; a caller's own fields beside them are the runtime's.
func decodeArgs(a map[string]any, into any) error {
raw, err := json.Marshal(a)
if err != nil {
return err
}
return json.Unmarshal(raw, into)
}
@@ -0,0 +1,82 @@
package main
import (
"context"
"fmt"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"mesh-delivery-assigner/internal/assigngraph"
)
// A store filling is said before it is full (design 47 G §181, in the assigner's part): the assignment graph revisions' object store
// says `filling` of the seat mesh-wants when it passes 80 % of its cap, and `full` when the next revision does not fit: the assigner then keeps
// its last revision and writes no new want, and says `room` when the store is back below 80 % and goes on. Nothing is dropped to make room.
// fillOf is the store's fill now: its bytes and cap, when the bucket says them and has a cap.
func (g *graphKeeper) fillOf(ctx context.Context) (used, capacity int64, ok bool) {
f, is := g.objects.(assigngraph.Filler)
if !is {
return 0, 0, false
}
used, capacity, err := f.Fill(ctx)
return used, capacity, err == nil && capacity > 0
}
func (p *passer) sayFill(event, about string, used, capacity int64, refused string) {
at := p.clock().UTC()
body := meshwants.Fill{Store: assigngraph.RevisionsObjects, Bytes: used, Cap: capacity, Refused: refused, At: &at}
if err := p.wantsSay(event, body, event+"-"+about); err != nil {
p.logf("%s of %s is not said: %v", event, assigngraph.RevisionsObjects, err)
}
}
// fillAtStart judges the store once at the process's first pass, when no event is pending: a store past 80 % says filling (full when at
// its cap), so a fill reached while the process was down is said too.
func (p *passer) fillAtStart(ctx context.Context) {
g := p.graph
used, capacity, ok := g.fillOf(ctx)
if !ok {
return
}
switch {
case used >= capacity:
g.full = true
p.sayFill(meshwants.EventFull, "start", used, capacity, "the next revision")
case used*5 >= capacity*4:
p.sayFill(meshwants.EventFilling, "start", used, capacity, "")
}
}
// fullBefore says the next revision does not fit its store, and keeps nothing: it says `full` once, and `room` once the store is below
// 80 % again. It answers true while the store is full.
func (p *passer) fullBefore(ctx context.Context, c assigngraph.Computed) bool {
g := p.graph
used, capacity, ok := g.fillOf(ctx)
if !ok {
return false
}
if g.full && used*5 < capacity*4 {
g.full = false
p.sayFill(meshwants.EventRoom, fmt.Sprint(used), used, capacity, "")
}
if used+assigngraph.NewBytes(ctx, g.objects, c) <= capacity {
g.full = false
return false
}
if !g.full {
g.full = true
p.sayFill(meshwants.EventFull, fmt.Sprint(used), used, capacity, "the next revision")
}
p.logf("the assignment graph revision is not kept: %s is full (%d of %d bytes), the last revision stays and no want is written until there is room", assigngraph.RevisionsObjects, used, capacity)
return true
}
// fillingAfter says `filling` when keeping a revision took the store past 80 % of its cap.
func (p *passer) fillingAfter(ctx context.Context, before int64) {
g := p.graph
used, capacity, ok := g.fillOf(ctx)
if ok && before*5 < capacity*4 && used*5 >= capacity*4 {
p.sayFill(meshwants.EventFilling, fmt.Sprint(used), used, capacity, "")
}
}
@@ -0,0 +1,83 @@
package main
import (
"context"
"testing"
"time"
mcc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"mesh-delivery-assigner/internal/assigngraph"
)
// filled is an object bucket with a fill: the bytes it holds count beside what is stored.
type filled struct {
objs map[string][]byte
base int64
cap int64
}
func (f *filled) Put(_ context.Context, name string, data []byte) error {
f.objs[name] = data
return nil
}
func (f *filled) Get(_ context.Context, name string) ([]byte, error) {
if d, ok := f.objs[name]; ok {
return d, nil
}
return nil, assigngraph.ErrNoObject
}
func (f *filled) Names(context.Context) ([]string, error) {
out := []string{}
for n := range f.objs {
out = append(out, n)
}
return out, nil
}
func (f *filled) Fill(context.Context) (int64, int64, error) {
used := f.base
for _, d := range f.objs {
used += int64(len(d))
}
return used, f.cap, nil
}
// Design 47 G §181 (AS13): the assignment graph revisions' store says filling past 80 % of its cap, refuses a revision that does not fit
// with `full` (the last revision stays, no want is written), and says `room` below 80 % again; at the start a store already past 80 % is said.
func TestTheAssignmentGraphStoreSaysFillingFullAndRoom(t *testing.T) {
ctx := context.Background()
p := newPasser(kvSet{}, time.Now())
var events []string
p.publishWants = func(event string, body any, id string) error {
if _, ok := body.(meshwants.Fill); ok {
events = append(events, event)
}
return nil
}
o := &filled{objs: map[string][]byte{}, base: 500, cap: 1000}
p.graph = &graphKeeper{objects: o, halves: func() map[string]mcc.Half { return nil }}
p.keepGraph(ctx) // the first pass judges at the start: 500 of 1000 is below 80 %
if len(events) != 0 {
t.Fatalf("events %v", events)
}
o.base = 700
p.graph.started = false
p.keepGraph(ctx)
if len(events) != 1 || events[0] != meshwants.EventFilling {
t.Fatalf("at the start past 80 %%: %v", events)
}
c := assigngraph.Computed{Revision: meshwants.AssignmentRevision{Entries: []meshwants.NodeEntryRef{}}}
o.base = 990
if !p.fullBefore(ctx, c) || !p.graph.full || events[len(events)-1] != meshwants.EventFull {
t.Fatalf("a revision that does not fit: events %v", events)
}
p.fullBefore(ctx, c)
if n := len(events); n != 2 {
t.Errorf("full is said once: %v", events)
}
o.base = 100
if p.fullBefore(ctx, c) || p.graph.full || events[len(events)-1] != meshwants.EventRoom {
t.Errorf("room: events %v", events)
}
}
@@ -0,0 +1,245 @@
package main
import (
"context"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"maps"
"slices"
"strings"
"time"
mcc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-sdk/go/keys"
"mesh-delivery-assigner/internal/assign"
"mesh-delivery-assigner/internal/assigngraph"
)
// graphKeeper is the pass's assignment graph (design 47 G §292, A-67): per catalog revision taken in it computes the revision
// from the catalog halves it follows, the placements, the first branch of each registration and each node's capability reading,
// keeps it in the objects assignment-revisions and says the seat mesh-wants' event assignment-revision; the wants of the pass
// that follows are written from the revision it holds.
type graphKeeper struct {
objects assigngraph.Objects
// halves is every followed branch's catalog graph revision held now.
halves func() map[string]mcc.Half
// last is the revision last computed, so a pass whose inputs did not change keeps and says nothing.
last meshwants.AssignmentRevision
has bool
// kept is the revision the wants follow, and kept's source the trunk's source revision it carries; ok is false until one is kept.
kept meshwants.AssignmentRevision
source int64
ok bool
said string
// cycled is the cycles last said (assigngraph.Cycles).
cycled string
// full says the next revision did not fit the store, so no want is written (graphfill.go); started says the first pass judged the fill.
full, started bool
// pins removes a revision that ceased to be current once nothing pins it (pins.go); nil keeps every revision.
pins *pinKeeper
// computed is the revision computed by the last pass, with its entries: the edges the wants wait on (actingwaits.go).
computed assigngraph.Computed
}
// keepGraph computes the revision of this pass and keeps it when the pass's inputs differ from the last computed.
func (p *passer) keepGraph(ctx context.Context) {
g := p.graph
if g == nil || g.objects == nil || g.halves == nil {
return
}
c := assigngraph.Compute(p.graphInputs())
g.computed = c
if p.ends != nil {
p.ends.setRunner(assigngraph.Runner(slices.Collect(maps.Values(c.Entries)))) // the runner's member of a group goes first (A-334)
}
for _, u := range c.Uncomputed {
if g.said != u {
g.said = u
p.logf("the assignment graph leaves out %s", u)
}
}
if cycles := strings.Join(c.Cycles, "; "); cycles != g.cycled {
g.cycled = cycles
if cycles != "" {
p.logf("the assignment graph holds a cycle among the acting waits, within one step or across steps: %s", cycles)
}
}
if !g.started {
g.started = true
p.fillAtStart(ctx)
}
if g.has && g.ok && assigngraph.Same(g.last, c.Revision) {
return
}
used, _, _ := g.fillOf(ctx)
if p.fullBefore(ctx, c) {
return
}
rev, fresh, err := assigngraph.Keep(ctx, g.objects, c, meshwants.EventAssignmentRevision, p.clock())
if err != nil {
p.logf("the assignment graph revision is not kept, so no want is said as wanted until it is: %v", err)
return
}
g.last, g.has, g.kept, g.ok = c.Revision, true, rev, true
g.source = 0
for _, cat := range rev.Catalogs {
if cat.Branch == p.w.trunkName() {
g.source = cat.Source
}
}
if !fresh {
return
}
p.fillingAfter(ctx, used)
if g.pins != nil {
g.pins.judge() // the revision before ceased to be current
}
id := fmt.Sprintf("%s-%s-%d", meshwants.EventAssignmentRevision, rev.Kind, rev.Revision)
if err := p.wantsSay(meshwants.EventAssignmentRevision, assigngraph.Event(rev), id); err != nil {
p.logf("the assignment revision %d is kept but not said: %v", rev.Revision, err)
}
}
// graphInputs are what the pass's assignment graph is computed from: every followed branch's catalog half, the placements, each
// node's capability reading and the first branch of each registration.
func (p *passer) graphInputs() assigngraph.Inputs {
in := assigngraph.Inputs{Halves: p.graph.halves(), Placements: p.w.assignments(), Capabilities: p.capabilityDigests()}
// The seat definitions read through the seat mesh-catalog's verb seat-definitions say which seat delivers a requirement
// (design 47 G §708).
if r := p.seats.Reader(); r != nil {
in.Definitions = r.Definitions()
}
// With no pipeline ends kept, the wants are the trunk-only form (pass.go): a placement naming no branch runs the trunk's.
first := p.w.trunkName()
in.FirstBranch = func(string) string { return first }
if p.ends != nil {
in.FirstBranch = func(module string) string { return p.ends.branchOf(module, "") }
}
return in
}
// capabilityDigests is each node's capability reading, by node: the statement its engine made of what it reads, and the
// capabilities its tool runner states with the fingerprint of the runner that announced them, as the node's record carries
// them (design 46 approval mark §6, lead answer A-203), the digest over all of it.
func (p *passer) capabilityDigests() []meshwants.AssignmentRevisionCapabilitiesItem {
records := p.w.records()
known := p.w.knownNodes()
slices.Sort(known)
var out []meshwants.AssignmentRevisionCapabilitiesItem
for _, node := range known {
read := p.reads != nil && p.reads.Known(node)
rec, recorded := records[node]
if !read && !recorded {
continue
}
var reads []string
if read {
reads = slices.Clone(p.reads.Reads([]string{node})[node])
slices.Sort(reads)
}
item := meshwants.AssignmentRevisionCapabilitiesItem{Node: node, Readings: slices.Clone(rec.RunnerCapabilities),
Fingerprint: rec.RunnerFingerprint}
slices.Sort(item.Readings)
raw, _ := json.Marshal(struct {
Reads []string `json:"reads"`
Readings []string `json:"readings"`
Fingerprint string `json:"fingerprint"`
}{reads, item.Readings, item.Fingerprint})
sum := sha256.Sum256(raw)
item.Digest = "sha256:" + hex.EncodeToString(sum[:])
out = append(out, item)
}
return out
}
// sayWanted says `wanted` for a want written or removed now, from the revision the pass keeps (A-61, A-67); with none kept, it is
// said in the log that it was not said. fp is the want's, and for a removal the fingerprint last wanted there.
func (p *passer) sayWanted(node, module, fp string, removed bool) {
if p.publishWants == nil {
return
}
g := p.graph
if g == nil || !g.ok {
p.logf("the want of %s on %s is written, but no assignment graph revision is kept, so wanted is not said", module, node)
return
}
at := p.clock().UTC()
body := meshwants.WantedEvent{V: keys.Version, Node: node, Module: module, Fp: fp, Removed: removed, Revision: g.kept.Revision, Source: g.source, At: &at}
event := strings.TrimPrefix(meshwants.SubjectWanted(keys.EscapeName(node), keys.EscapeName(module)), "mesh.seat."+meshwants.Seat+".event.")
id := fmt.Sprintf("wanted.%s.%s.%s.%t.%d.%s", keys.EscapeName(node), keys.EscapeName(module), fp, removed, g.kept.Revision, at.Format(time.RFC3339Nano))
if err := p.wantsSay(event, body, id); err != nil {
p.logf("wanted of %s on %s is not said: %v", module, node, err)
}
}
// namedBuild answers what a want of module at fp names of its build (design 47 G §379, §526, A-96): a kept build's or another watched
// branch's parts and keeping node from the builder's `build.ended`; for the trunk's entry (fp is the module's, trunkFP), the released
// version and the parts of the `version-released` of the module whose source is the one its fingerprint was built at, the entry's
// `fp-src` (A-419: a merge that does not rebuild the module leaves it so), or for an entry naming none the one whose parts are the
// digests its build.ended made (A-421). A trunk entry whose release is not heard is said, once, naming which was tried.
func (p *passer) namedBuild(module, trunkFP string, fpSrc int64, unreleased ...bool) func(fp string) (assign.KeptBuild, bool) {
return func(fp string) (assign.KeptBuild, bool) {
if k, ok := p.w.ends.partsOf(module, fp); ok {
return k, true
}
if len(unreleased) > 0 && unreleased[0] && fp == trunkFP {
// Wanted with no passed pipeline (the holder of mesh-catalog, the runner's first start): no pipeline released it,
// so its want names the parts its build.ended made, until a release of it is heard (design 47 G §16, A-428).
if k, ok := p.w.released.withParts(module, p.w.ends.madeOf(module, fp)); ok {
return k, true
}
if made := p.w.ends.madeOf(module, fp); len(made) > 0 {
return assign.KeptBuild{Parts: made}, true
}
}
if fp != trunkFP {
// A want held back at an older build (rule 2: no pipeline passed at the trunk's newer fingerprint) names that build's
// release when one names exactly the digests it made (novox 2026-11-16: mesh-hand-acts 0.1.13 held at 4eb3cf48 after
// the mesh-sdk merge moved its fingerprint).
return p.w.released.withParts(module, p.w.ends.madeOf(module, fp))
}
if p.graph == nil || !p.graph.ok {
p.unheardRelease(module, fp, "no assignment graph revision is kept yet, so no release is looked up")
return assign.KeptBuild{}, false
}
if fpSrc == 0 {
// No fp-src (its fingerprint moved with no merge): the release whose parts are what its build made (A-421).
if k, ok := p.w.released.withParts(module, p.w.ends.madeOf(module, fp)); ok {
return k, true
}
p.unheardRelease(module, fp, "its catalog entry names no fp-src, and no version-released of it names the parts its build.ended made")
return assign.KeptBuild{}, false
}
k, ok := p.w.released.of(module, fpSrc)
if !ok {
// The release names the source its reservation was made at, which can be an earlier revision than the entry's
// fp-src (novox 2026-11-16: mesh-hand-acts 0.1.13 released from 962, its entry's fp-src 963): the release whose parts
// are exactly the digests this fingerprint's build made is this build's (A-421).
if k, ok = p.w.released.withParts(module, p.w.ends.madeOf(module, fp)); ok {
return k, true
}
p.unheardRelease(module, fp, fmt.Sprintf("no version-released of it from source %d, the one its fingerprint was built at, nor one naming the parts its build.ended made, is heard", fpSrc))
}
return k, ok
}
}
// unheardRelease says once per module, fingerprint and why that a trunk entry's release is not heard, so its wants and candidates
// carry no version and no parts (design 47 G A-419).
func (p *passer) unheardRelease(module, fp, why string) {
key := "release " + module + "@" + fp + ": " + why
if p.skipped[key] {
return
}
if p.skipped == nil {
p.skipped = map[string]bool{}
}
p.skipped[key] = true
if p.logf != nil {
p.logf("the release of %s at fingerprint %s is not heard: %s; its wants and candidates carry no version and no parts", module, fp, why)
}
}
@@ -0,0 +1,134 @@
package main
import (
"context"
"encoding/json"
"slices"
"strings"
"testing"
"time"
"git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
mcc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
mwc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshwantsclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"mesh-delivery-assigner/internal/assigngraph"
"mesh-delivery-assigner/internal/buckets"
)
// said is one event the passer said on the seat mesh-wants.
type said struct {
event, id string
body json.RawMessage
}
// Design 47 G A-67, §292: the pass keeps an assignment graph revision per catalog revision taken in, before it writes any want, and
// says assignment-revision; A-61, §693: a want written or removed is said `wanted` on the subject of its node and module in the same
// write, from the kept revision and its catalog's source, a put that wrote nothing says nothing, and with no revision kept none is said.
func TestTheWantsAreSaidWantedFromTheKeptAssignmentGraphRevision(t *testing.T) {
ctx := context.Background()
at := time.Date(2026, 11, 12, 9, 0, 0, 0, time.UTC)
kv := &memKV{values: map[string][]byte{}}
p := newPasser(kvSet{buckets.Wants(): kv}, at)
p.logf = t.Logf
var events []said
p.publishWants = func(event string, body any, id string) error {
raw, _ := json.Marshal(body)
events = append(events, said{event, id, raw})
return nil
}
placeOn(t, p.w, "ace", "web")
// Design 46 approval mark §6: a node's reading keeps the fingerprint of the runner that announced it, as its record says.
rec, _ := json.Marshal(nodeengine.HaveByNodeNodeValue{V: 1, Record: &nodeengine.NodeRecord{V: 1, Node: "ace",
RunnerCapabilities: []string{"bus-state-calls", "approval-mark/1"}, RunnerFingerprint: "sha256:runner"}})
p.w.put(buckets.Have, "ace.node", rec)
if c := p.capabilityDigests(); len(c) != 1 || c[0].Node != "ace" || c[0].Fingerprint != "sha256:runner" ||
!slices.Equal(c[0].Readings, []string{"approval-mark/1", "bus-state-calls"}) || !strings.HasPrefix(c[0].Digest, "sha256:") {
t.Errorf("the capability readings are %+v", c)
}
half := mcc.Half{Revision: meshcatalog.CatalogRevision{Branch: trunkBranch, Kind: "trunk", Revision: 4, Source: 9,
Entries: []meshcatalog.EntryRef{{Module: "web", Digest: "sha256:" + strings.Repeat("a", 64)}}},
Entries: map[string]meshcatalog.CatalogEntry{"web": {Module: "web", Fp: fpTest}}}
objects := memObjects{}
p.graph = &graphKeeper{objects: objects, halves: func() map[string]mcc.Half { return map[string]mcc.Half{trunkBranch: half} }}
want := mwc.Want{Fp: fpTest, Self: true}
p.putWant(ctx, "ace", "web", want) // no revision kept yet: written, and not said
if len(events) != 0 || kv.puts != 1 {
t.Fatalf("with no revision kept: %d events, %d puts", len(events), kv.puts)
}
key, _ := mwc.WantKey("ace", "web")
delete(p.w.read(buckets.Wants()), key) // the world forgets the want, as before the first pass
kv.puts = 0
p.w.put(buckets.Wants(), key, nil)
p.keepGraph(ctx)
if len(events) != 1 || events[0].event != meshwants.EventAssignmentRevision || len(objects) == 0 {
t.Fatalf("the pass kept %d objects and said %+v", len(objects), events)
}
p.keepGraph(ctx) // the same inputs: nothing kept, nothing said
if len(events) != 1 {
t.Fatalf("a pass of the same inputs said %d events", len(events))
}
p.putWant(ctx, "ace", "web", want)
p.putWant(ctx, "ace", "web", want) // unchanged: not written, not said
if len(events) != 2 || kv.puts != 1 {
t.Fatalf("a want put twice: %d events, %d puts", len(events), kv.puts)
}
if wantEvent := "wanted.ace.web"; events[1].event != wantEvent {
t.Errorf("wanted said on %q, want %q", events[1].event, wantEvent)
}
var w meshwants.WantedEvent
if err := json.Unmarshal(events[1].body, &w); err != nil || w.Node != "ace" || w.Module != "web" || w.Fp != fpTest || w.Removed || w.Revision != 1 || w.Source != 9 {
t.Errorf("wanted = %+v (%v)", w, err)
}
p.putWant(ctx, "ace", "web", mwc.Want{Removed: true})
if err := json.Unmarshal(events[len(events)-1].body, &w); err != nil || len(events) != 3 || !w.Removed || w.Fp != fpTest {
t.Errorf("a removing want said %+v (%v), %d events", w, err, len(events))
}
// A-201, A-235: a run's candidate catalog revision, read whole through the seat's verb revision, keeps the run's assignment
// graph under candidate.<group>.<heads> in place of its branch's half; it says nothing and writes no want, a try's candidate
// keeps none, and the run's group-ended drops it.
before, puts := len(events), kv.puts
ev := meshcatalog.CatalogRevisionEvent{Kind: "candidate", Branch: trunkBranch, Group: "run-7", Heads: "h1", Revision: 5}
var asked []meshcatalog.RevisionInput
call := func(key string, body any) (json.RawMessage, error) {
in := body.(meshcatalog.RevisionInput)
asked = append(asked, in)
rev := meshcatalog.CatalogRevision{Branch: trunkBranch, Kind: "candidate", Group: "run-7", Heads: "h1", Revision: 5, Source: 9,
Entries: []meshcatalog.EntryRef{{Module: "web", Digest: "sha256:" + strings.Repeat("b", 64)}}}
a := meshcatalog.RevisionAnswer{Revision: &rev, Entries: []meshcatalog.CatalogEntry{{Module: "web", Fp: "src2:w2"}}}
return json.Marshal(a)
}
if err := p.keepCandidate(ctx, call, meshcatalog.CatalogRevisionEvent{Kind: "candidate", Branch: trunkBranch, Group: "try-3", Heads: "h", Revision: 2}); err != nil || len(asked) != 0 {
t.Errorf("a try's candidate asked %v: %v", asked, err)
}
if err := p.keepCandidate(ctx, call, ev); err != nil {
t.Fatal(err)
}
if len(asked) != 1 || asked[0].Group != "run-7" || asked[0].Heads != "h1" || asked[0].Revision != 5 {
t.Errorf("the candidate's revision was asked as %+v", asked)
}
a, err := assigngraph.Revision(ctx, objects, meshwants.RevisionInput{Group: "run-7"})
if err != nil || a.Revision.Kind != "candidate" || len(a.Revision.Catalogs) != 1 || a.Revision.Catalogs[0].Revision != 5 {
t.Errorf("the run's assignment graph is %+v: %v", a.Revision, err)
}
if e, err := assigngraph.Entry(ctx, objects, meshwants.EntryInput{Group: "run-7", Node: "ace", Module: "web"}); err != nil || e.Entry.Fp != "src2:w2" {
t.Errorf("the run's entry of web is %+v: %v", e.Entry, err)
}
if len(events) != before || kv.puts != puts {
t.Errorf("a candidate said %d events and wrote %d wants", len(events)-before, kv.puts-puts)
}
if err := p.dropCandidate(ctx, "run-7"); err != nil {
t.Fatal(err)
}
if _, ok := objects[assigngraph.CandidateObject("run-7", "h1")]; ok {
t.Error("the run's group-ended left its candidate kept")
}
if _, err := assigngraph.Revision(ctx, objects, meshwants.RevisionInput{}); err != nil {
t.Errorf("dropping the run's candidate dropped trunk: %v", err)
}
}
@@ -0,0 +1,198 @@
package main
import (
"context"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"slices"
"sync"
"time"
mcc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/graph"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-sdk/go/views"
)
// halves follows the catalog half of each watched branch through the seat mesh-catalog (design 47 G §14, §184, §195, §507, §532): the
// branch follower of meshcatalogclient, adopted on the module's views reader (A-26), follows the branches the registrations name
// and, before the first registrations, the branches the gate's verb `source` answers and its event `source-moved` brings; each
// branch's view asks the verb `revision`, hears each `catalog-revision` of that branch and raises and clears the follower's findings;
// each entry is taken into the world as the value and the graph node the rules read. Of the view the assigner reads only the catalog
// half, never its own output back (§195).
type halves struct {
w *world
call mcc.Call
reader *views.ProcessReader
wake func()
logf func(string, ...any)
ctx context.Context
branches *mcc.Branches
mu sync.Mutex
// settled is told once when the first watched branch's first view is answered, for the first pass to wait on.
settled chan<- struct{}
told bool
}
// follow makes the branch follower on the reader; the reader's start asks the first views.
func (h *halves) follow() error {
b, err := mcc.FollowBranchesProcess(h.reader, h.call)
if err != nil {
return err
}
b.Logf = h.logf
b.Changed = func(branch, module string, entry json.RawMessage, deleted bool, _ time.Time) {
h.changed(branch, module, entry, deleted)
}
b.Adopted = h.adopted
h.mu.Lock()
h.branches = b
h.mu.Unlock()
h.settleWhenNoBranch()
return nil
}
// settleWhenNoBranch tells the first pass once, when the registrations and the gate's source are answered and name no branch: the
// trunk is none-yet and the world is empty, as the catalog client's Ready says it (design 47 G, A-372). A mesh that names a branch is
// told by adopted, when that branch's first view is answered.
func (h *halves) settleWhenNoBranch() {
if h.settled == nil {
return
}
h.mu.Lock()
b := h.branches
h.mu.Unlock()
go func() {
select {
case <-b.FirstViews(h.ctx):
case <-h.ctx.Done():
return
}
if len(b.Followed()) > 0 || b.Ready() != nil {
return
}
h.mu.Lock()
told := h.told
h.told = true
h.mu.Unlock()
if !told {
h.settled <- struct{}{}
}
}()
}
// first is the first watched branch followed, the trunk's: "" while none is.
func (h *halves) first() string {
h.mu.Lock()
b := h.branches
h.mu.Unlock()
if b == nil {
return ""
}
if f := b.Followed(); len(f) > 0 {
return f[0]
}
return ""
}
// adopted is told of each branch whose view the follower adopted: the first branch is the trunk's, and the first pass waits for its
// first view.
func (h *halves) adopted(branch string, c *mcc.Catalog) {
first := h.first()
if first == "" {
return
}
h.w.setTrunk(first)
h.wake()
if branch != first || h.settled == nil {
return
}
h.mu.Lock()
told := h.told
h.told = true
h.mu.Unlock()
if told {
return
}
go func() {
select {
case <-c.Ready():
h.settled <- struct{}{}
case <-h.ctx.Done():
}
}()
}
// changed takes one entry of branch's half into the world, or a module taken out of it.
func (h *halves) changed(branch, module string, raw json.RawMessage, deleted bool) {
defer h.wake()
if deleted {
h.w.dropModule(branch, module)
return
}
var e meshcatalog.CatalogEntry
if err := json.Unmarshal(raw, &e); err != nil {
h.logf("the entry of %s on branch %q does not read: %v", module, branch, err)
return
}
v, n, m := fromEntry(e)
h.w.putModule(branch, module, v, n, m)
h.w.putEdges(branch, module, e.Edges)
}
// fromEntry is a catalog entry as the value and the graph node the rules read, and its manifest parsed once under the digest of
// its words.
func fromEntry(e meshcatalog.CatalogEntry) (meshcatalog.ModulesByModuleValue, graph.Node, *parsed) {
v := meshcatalog.ModulesByModuleValue{Commit: e.Commit, Fp2: e.Fp, Needs: e.Needs, None2: e.None, Packages: e.Packages,
Path: e.Path, Repository: e.Repository, Verdict: e.Verdict}
// The source revisions it was taken in at and its fingerprint was built at: the release of a trunk build is matched by the
// latter (design 47 G A-419).
if e.Inputs != nil {
v.Src, v.FpSrc = e.Inputs.Src, e.Inputs.FpSrc
}
n := graph.Node{FP: e.Fp, None: e.None, Repository: e.Repository, Path: e.Path, Bases: e.Bases, Provides: e.Provides, Requires: e.Requires,
Awaits: e.Awaits, Invokes: e.Invokes, Serves: e.Serves, LeftOut: e.LeftOut}
for p := range e.Packages {
n.Packages = append(n.Packages, p)
}
slices.Sort(n.Packages)
if len(e.Manifest) == 0 {
return v, n, nil
}
raw, err := json.Marshal(e.Manifest)
if err != nil {
return v, n, nil
}
sum := sha256.Sum256(raw)
v.Manifest = "sha256:" + hex.EncodeToString(sum[:])
man, err := catalogue.Decode(raw)
if err != nil {
return v, n, &parsed{module: e.Module, err: "it does not decode: " + err.Error()}
}
n.Serves = graph.ServesOf(man)
// The entry's requires name the optional ones too; the node means those required, not optionally (A-229).
n.Requires = slices.DeleteFunc(slices.Clone(n.Requires), man.IsOptional)
return v, n, &parsed{module: e.Module, manifest: man}
}
// views is the catalog graph revision held now of each followed branch whose first view is answered.
func (h *halves) views() map[string]mcc.Half {
h.mu.Lock()
b := h.branches
h.mu.Unlock()
out := map[string]mcc.Half{}
if b == nil {
return out
}
for _, branch := range b.Followed() {
if c, ok := b.Catalog(branch); ok {
if half, ok := c.View(); ok {
out[branch] = half
}
}
}
return out
}
@@ -0,0 +1,50 @@
package main
import (
"context"
"encoding/json"
"testing"
"time"
mcc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
seat "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-sdk/go/views"
)
// Design 47 G A-372: the assigner's wait for its catalog half asks the catalog client's Ready as well: a mesh whose registrations and
// gate's source are answered and name no branch is none-yet, and the first pass is told so once; before they answer it is not told.
func TestAMeshThatNamesNoBranchSettlesTheAssignersFirstPass(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
call := func(key string, _ any) (json.RawMessage, error) {
if key == mcc.RegistrationsVerb {
return json.Marshal(seat.RegistrationsAnswer{Registrations: []seat.Registration{}})
}
return json.Marshal(map[string][]string{"branches": {}})
}
for _, answered := range []bool{false, true} {
settled := make(chan struct{}, 2)
reader := &views.ProcessReader{Module: "mesh-delivery-assigner", Call: call, Logf: t.Logf}
h := &halves{w: newWorld(), call: call, reader: reader, wake: func() {}, logf: t.Logf, ctx: ctx, settled: settled}
if err := h.follow(); err != nil {
t.Fatal(err)
}
if answered {
for _, f := range reader.Followers() {
if err := f.Start(ctx); err != nil {
t.Fatal(err)
}
}
select {
case <-settled:
case <-ctx.Done():
t.Fatal("a mesh that names no branch never settled the first pass")
}
}
select {
case <-settled:
t.Errorf("answered %v: the first pass was told twice or before the first views", answered)
default:
}
}
}
@@ -0,0 +1,581 @@
package main
import (
"context"
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"regexp"
"slices"
"strings"
"sync"
"time"
"github.com/nats-io/nats.go/jetstream"
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/buscalls"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-sdk/go/keys"
"git.novox.be/novox/mesh-sdk/go/process"
"git.novox.be/novox/mesh-sdk/go/stateobjects"
"mesh-delivery-assigner/internal/buckets"
)
// A step's input by its digest (design 47 G §354, §712, A-237, A-243): the assigner keeps the input of each composition step
// request it asked a build seat to run in its state `inputs`, one key per input, its sha256 alone (A-465a), the value the input's bytes in
// base64 with the state's object store `inputs-objects` holding one over a key's limit (mesh-sdk stateobjects), and the seat
// mesh-wants' verb `input` answers one by its digest in chunks, to the holders of the build seats alone (the verb's callers, §338).
// An input is kept once per content: every ask that names its digest shares it (A-465a). It is deleted, with its object, when the
// step-ended of the last ask that names it is heard, or a day after its last write, whichever is first, the day judged at each new
// ask over at most 20 of the oldest inputs. `assigner_inputs` reads them. This mirrors the indexer's
// (mesh-delivery-indexer internal/index/run_inputs.go): the two are separate modules' code, owed to mesh-sdk.
// inputsTool is the tool that reads the kept inputs.
const inputsTool = "assigner_inputs"
const (
// inputsKeptFor is how long an input is kept at the longest.
inputsKeptFor = 24 * time.Hour
// inputsSwept is how many of the oldest keys each new ask judges.
inputsSwept = 20
inputsTime = "20060102T150405Z"
// inputsAskPrefix opens the keys that name an input by the id of the ask it was kept for: ask.<id>, the id escaped as a name,
// holding the digest of the input the ask uses, so the build seat's step-ended of that ask finds it.
inputsAskPrefix = "ask."
)
// inputAsk is what an ask's key holds (A-465b): the digest of the input the ask uses and the time the ask wrote it, in inputsTime.
type inputAsk struct {
Digest string `json:"digest"`
At string `json:"at"`
}
// readAsk reads an ask's key: the JSON form, or the bare key of the old form `<time>.<digest>` an earlier assigner wrote, which
// carries its time in the key itself.
func readAsk(raw []byte) (digest string, at time.Time) {
var a inputAsk
if json.Unmarshal(raw, &a) == nil && a.Digest != "" {
at, _ = time.Parse(inputsTime, a.At)
return a.Digest, at
}
digest = string(raw)
t, _, _ := strings.Cut(digest, ".")
at, _ = time.Parse(inputsTime, t)
return digest, at
}
// isDigest is whether a key is an input's own key: 64 hex digits.
func isDigest(key string) bool {
if len(key) != 64 {
return false
}
_, err := hex.DecodeString(key)
return err == nil
}
// digestOf is an input's digest as the ask names it: its sha256 in hex.
func digestOf(b []byte) string { sum := sha256.Sum256(b); return hex.EncodeToString(sum[:]) }
// inputsCap is the state inputs' cap (design 47 G §354's kept-data row: 64 MiB, the manifest's max-mib): at it, an ask is refused.
const inputsCap = 64 << 20
// inputKeeper keeps the inputs over the state and its object store.
type inputKeeper struct {
vals stateobjects.Values
now func() time.Time
logf func(string, ...any)
// used is how many bytes the state and its object store hold; nil judges no cap.
used func() (int64, error)
}
// keep keeps the exact bytes of the input of the ask under their sha256, after sweeping, and names the digest and the time in the
// ask's key; it answers the digest. The same bytes asked again are the same one input (A-465a, A-465b). The ask's key is written
// first, so a sweep never finds the input unnamed.
func (k *inputKeeper) keep(ask string, body []byte) (string, error) {
if ask == "" {
return "", errors.New("name the ask the input is kept for")
}
if err := k.sweep(); err != nil {
k.logf("inputs: the keys older than a day are not all deleted: %v", err)
}
digest := digestOf(body)
raw, err := json.Marshal(inputAsk{Digest: digest, At: k.now().UTC().Format(inputsTime)})
if err != nil {
return "", err
}
askKey := inputsAskPrefix + keys.EscapeName(ask)
if err := k.vals.KV.Create(askKey, raw); err != nil && !errors.Is(err, stateobjects.ErrChanged) {
return "", err
}
have, err := k.vals.KV.Get(digest)
if err != nil {
return "", err
}
if have != nil {
return digest, nil
}
if k.used != nil {
used, err := k.used()
if err == nil && used+int64(len(body)) > inputsCap {
err = fmt.Errorf("the state %s is at its cap of %d MiB (%d bytes kept), so the ask's input of %d bytes is refused",
buckets.InputsState, inputsCap>>20, used, len(body))
} else if err != nil {
err = fmt.Errorf("the fill of the state %s is not read, so no input is kept: %w", buckets.InputsState, err)
}
if err != nil {
_ = k.vals.KV.Delete(askKey)
return "", err
}
}
if err := k.vals.Put(digest, base64.StdEncoding.EncodeToString(body)); err != nil && !errors.Is(err, stateobjects.ErrChanged) {
return "", err
}
return digest, nil
}
// ended removes the ask's key when the build seat's step-ended of that ask is heard, and deletes the input it named, with its
// object, when no other ask's key names it (A-465a); an ask that kept none changes nothing.
func (k *inputKeeper) ended(ask string) error {
if ask == "" {
return nil
}
askKey := inputsAskPrefix + keys.EscapeName(ask)
e, err := k.vals.KV.Get(askKey)
if err != nil || e == nil {
return err
}
digest, _ := readAsk(e.Value)
if err := k.vals.KV.Delete(askKey); err != nil {
return err
}
named, err := k.named()
if err != nil {
return err
}
if named[digest] {
return nil // another running ask still names it
}
return k.deleteInput(digest)
}
// named is the inputs some ask's key names now.
func (k *inputKeeper) named() (map[string]bool, error) {
all, err := k.vals.KV.Keys()
if err != nil {
return nil, err
}
named := map[string]bool{}
for _, key := range all {
if !strings.HasPrefix(key, inputsAskPrefix) {
continue
}
o, err := k.vals.KV.Get(key)
if err != nil {
return nil, err
}
if o != nil {
d, _ := readAsk(o.Value)
named[d] = true
}
}
return named, nil
}
// deleteInput deletes an input's key and the object that key names, when it names one (A-465): an owner that ends its own key
// ends its object. A key already gone leaves nothing to remove here; the start and assigner_inputs_drop remove what a key left.
func (k *inputKeeper) deleteInput(key string) error {
e, err := k.vals.KV.Get(key)
if err != nil {
return err
}
if err := k.vals.KV.Delete(key); err != nil {
return err
}
if e == nil {
return nil
}
if ref, ok := stateobjects.ReadRef(e.Value); ok {
if err := k.vals.Objects.Delete(ref.Object); err != nil {
return fmt.Errorf("the object %s of %s: %w", ref.Object, key, err)
}
}
return nil
}
// dropKeyGone removes every object of the state whose key is gone and answers their count and bytes (A-465).
func (k *inputKeeper) dropKeyGone() (dropped []stateobjects.Kept, bytes int64, err error) {
kept, err := k.vals.Kept()
if err != nil {
return nil, 0, err
}
names, err := k.vals.DropKeyGone()
gone := map[string]bool{}
for _, n := range names {
gone[n] = true
}
for _, o := range kept {
if gone[o.Name] {
dropped = append(dropped, o)
bytes += o.Size
}
}
return dropped, bytes, err
}
// dropAtStart removes the objects whose key is gone at the program's start, said with their count and bytes (A-465). An object
// store not on the bus yet is said and left.
func (k *inputKeeper) dropAtStart() {
dropped, bytes, err := k.dropKeyGone()
if err != nil {
k.logf("inputs: the objects of deleted keys are not all removed at the start (%d objects, %d bytes removed): %v", len(dropped), bytes, err)
return
}
k.logf("inputs: %d objects of deleted keys removed at the start, %d bytes", len(dropped), bytes)
}
// sweep deletes, among the 20 oldest ask keys, those written more than a day ago; every input of the digest form no ask's key names
// now, with its object; a key of the old form `<time>.<digest>` a day after the time it carries; and an old-form ask key whose
// input is gone (A-465b).
func (k *inputKeeper) sweep() error {
all, err := k.vals.KV.Keys()
if err != nil {
return err
}
var errs []error
type askAt struct {
key string
at time.Time
}
var asks []askAt
var inputs []string
for _, key := range all {
if strings.HasPrefix(key, inputsAskPrefix) {
e, err := k.vals.KV.Get(key)
if err != nil || e == nil {
continue
}
d, at := readAsk(e.Value)
if !isDigest(d) {
if gone, err := k.vals.KV.Get(d); err == nil && gone == nil {
errs = append(errs, k.vals.KV.Delete(key))
}
}
asks = append(asks, askAt{key, at})
continue
}
if !isDigest(key) {
t, _, _ := strings.Cut(key, ".")
if at, err := time.Parse(inputsTime, t); err == nil && k.now().Sub(at) >= inputsKeptFor {
errs = append(errs, k.deleteInput(key))
}
continue
}
inputs = append(inputs, key)
}
slices.SortFunc(asks, func(a, b askAt) int { return a.at.Compare(b.at) })
if len(asks) > inputsSwept {
asks = asks[:inputsSwept]
}
for _, a := range asks {
if !a.at.IsZero() && k.now().Sub(a.at) >= inputsKeptFor {
errs = append(errs, k.vals.KV.Delete(a.key))
}
}
named, err := k.named()
if err != nil {
return errors.Join(append(errs, err)...)
}
for _, key := range inputs {
if !named[key] {
errs = append(errs, k.deleteInput(key))
}
}
return errors.Join(errs...)
}
// keyOf is the key of the input of the digest, or none: the digest itself.
func (k *inputKeeper) keyOf(digest string) (string, error) {
if !isDigest(digest) {
return "", nil
}
e, err := k.vals.KV.Get(digest)
if err != nil || e == nil {
return "", err
}
return digest, nil
}
// body is the exact bytes of the input of the digest, checked against it, whatever its size.
func (k *inputKeeper) body(digest string) ([]byte, error) {
if len(digest) != 64 {
return nil, errors.New("input takes the input's sha256, 64 hex digits")
}
key, err := k.keyOf(digest)
if err != nil {
return nil, fmt.Errorf("the state %s cannot be read: %w", buckets.InputsState, err)
}
if key == "" {
return nil, fmt.Errorf("the assigner keeps no input with the digest %s", digest)
}
var text string
found, err := k.vals.Get(key, &text)
if err != nil {
return nil, fmt.Errorf("the input %s cannot be read: %w", key, err)
}
if !found {
return nil, fmt.Errorf("the assigner keeps no input with the digest %s", digest)
}
b, err := base64.StdEncoding.DecodeString(text)
if err != nil || digestOf(b) != digest {
return nil, fmt.Errorf("the input %s does not hold the bytes its digest names", key)
}
return b, nil
}
var callToken = regexp.MustCompile(`^[A-Za-z0-9_-]{16,64}$`)
// verb answers the seat's verb input (marked chunks): the digest and how many chunks carry the bytes, then sends them in chunks of at
// most buscalls.SeatChunkBytes on the call's chunk subjects, each acknowledged before the next (A-237, A-139). The input is of any
// size. A caller that does not acknowledge within `within` ends the send, said in logf.
func (k *inputKeeper) verb(line buscalls.ChunkLine, within time.Duration) process.SeatHandler {
return func(_ string, raw json.RawMessage) (any, error) {
var in meshwants.InputInput
if err := json.Unmarshal(raw, &in); err != nil {
return nil, fmt.Errorf("the arguments are not JSON: %w", err)
}
if !callToken.MatchString(in.Call) {
return nil, errors.New("call is one token of 16 to 64 letters, digits, - or _: 128 random bits the caller chooses")
}
digest := strings.TrimPrefix(strings.TrimSpace(in.Digest), "sha256:")
body, err := k.body(digest)
if err != nil {
return nil, err
}
send := buscalls.SeatChunks{Seat: meshwants.Seat, Verb: meshwants.VerbInput, Call: in.Call}
total := int64((len(body) + buscalls.SeatChunkBytes - 1) / buscalls.SeatChunkBytes)
// the send subscribes to the acknowledgements itself and ends when it has sent every chunk or one is not acknowledged
go func() {
if err := send.Send(line, body, within, k.logf); err != nil {
k.logf("the send %s of the input %s: %v", in.Call, digest, err)
}
}()
return meshwants.InputAnswer{Digest: digest, Chunks: total}, nil
}
}
// inputObjects is the object store beside the state inputs (`inputs-objects`, a state's own, §712), opened when first used: until
// the grants part has made it every call is process.ErrNotYet.
type inputObjects struct {
js jetstream.JetStream
module string
mu sync.Mutex
bus stateobjects.Objects
}
func (o *inputObjects) open() (stateobjects.Objects, error) {
o.mu.Lock()
defer o.mu.Unlock()
if o.bus != nil {
return o.bus, nil
}
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
store, err := o.js.ObjectStore(ctx, catalogue.BusName(o.module, catalogue.StateObjectsName(buckets.InputsState)))
if errors.Is(err, jetstream.ErrBucketNotFound) || errors.Is(err, jetstream.ErrStreamNotFound) {
return nil, fmt.Errorf("the object store of the state inputs is not on the bus yet: %w", process.ErrNotYet)
}
if err != nil {
return nil, fmt.Errorf("the object store of the state inputs is not open: %w", err)
}
o.bus = stateobjects.BusObjects{Store: store}
return o.bus, nil
}
func (o *inputObjects) MostBytes() int { return 0 }
func (o *inputObjects) Put(name string, data []byte) error {
b, err := o.open()
if err != nil {
return err
}
return b.Put(name, data)
}
func (o *inputObjects) Get(name string) ([]byte, error) {
b, err := o.open()
if err != nil {
return nil, err
}
return b.Get(name)
}
func (o *inputObjects) Delete(name string) error {
b, err := o.open()
if err != nil {
return err
}
return b.Delete(name)
}
func (o *inputObjects) List() ([]stateobjects.Object, error) {
b, err := o.open()
if err != nil {
return nil, err
}
return b.List()
}
// inputsOver is the inputs the program keeps, over its bucket and its object store beside it; nil when the bucket is not opened.
func inputsOver(kv jetstream.KeyValue, js jetstream.JetStream, module string, logf func(string, ...any)) *inputKeeper {
if kv == nil {
return nil
}
objects := &inputObjects{js: js, module: module}
v := stateobjects.Values{KV: stateobjects.BusKV{KV: kv}, Objects: objects, Store: catalogue.StateObjectsName(buckets.InputsState)}
used := func() (int64, error) {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
st, err := kv.Status(ctx)
if err != nil {
return 0, err
}
n := int64(st.Bytes())
objs, err := objects.List()
if err != nil && !errors.Is(err, process.ErrNotYet) {
return 0, err
}
for _, o := range objs {
n += o.Size
}
return n, nil
}
return &inputKeeper{vals: v, now: time.Now, logf: logf, used: used}
}
// inputSaid is one kept input as assigner_inputs lists it.
type inputSaid struct {
Key string `json:"key"`
Time string `json:"time"`
Digest string `json:"digest"`
Size int `json:"size"`
Input string `json:"input,omitempty"`
}
// inputsRead is the tool assigner_inputs over the kept inputs: every kept input with its size, or the one named by digest whole.
func inputsRead(k *inputKeeper) stdio.Tool {
return stdio.Tool{Name: inputsTool, Description: "The inputs the assigner keeps for the composition steps it asked a build seat to run (design 47 G §354): each " +
"with its write time, digest and size, or one by `digest` whole (base64). Read-only.",
Input: schema(map[string]string{"digest": "one input's sha256"}, nil), Run: func(args map[string]any) (any, error) {
want := arg(args, "digest")
all, err := k.vals.KV.Keys()
if err != nil {
return nil, fmt.Errorf("the inputs cannot be listed: %w", err)
}
slices.Sort(all)
lastAsk := map[string]string{} // the latest write time an ask's key names for each input
for _, key := range all {
if e, err := k.vals.KV.Get(key); err == nil && e != nil && strings.HasPrefix(key, inputsAskPrefix) {
if d, at := readAsk(e.Value); !at.IsZero() && at.Format(inputsTime) > lastAsk[d] {
lastAsk[d] = at.Format(inputsTime)
}
}
}
out := []inputSaid{}
for _, key := range all {
d := key
if !isDigest(key) || (want != "" && d != want) {
continue
}
t := lastAsk[key]
var text string
if found, err := k.vals.Get(key, &text); err != nil || !found {
continue
}
said := inputSaid{Key: key, Time: t, Digest: d, Size: base64.StdEncoding.DecodedLen(len(text))}
if b, err := base64.StdEncoding.DecodeString(text); err == nil {
said.Size = len(b)
}
if want != "" {
said.Input = text
}
out = append(out, said)
}
gone := []map[string]any{}
var goneBytes int64
answer := map[string]any{"inputs": out}
kept, err := k.vals.Kept()
if err != nil {
// never an empty list for objects that could not be read (A-465)
answer["key-gone-error"] = fmt.Sprintf("the objects of the state inputs cannot be listed, so key-gone objects are not known: %v", err)
return answer, nil
}
for _, o := range kept {
if o.KeyGone {
gone = append(gone, map[string]any{"object": o.Name, "key": o.Key, "size": o.Size})
goneBytes += o.Size
}
}
answer["key-gone"], answer["key-gone-bytes"] = gone, goneBytes
return answer, nil
}}
}
// inputsDropTool is the tool that removes the objects whose key is gone.
const inputsDropTool = "assigner_inputs_drop"
// inputsDrop is the tool assigner_inputs_drop (A-465): a hand act, recorded first, that removes the objects of the state inputs
// whose key is gone now and answers what it removed.
func inputsDrop(k *inputKeeper, ask func(string, any) (json.RawMessage, error)) stdio.Tool {
return stdio.Tool{Name: inputsDropTool, Description: "Remove the objects of the assigner's state inputs whose key is gone now (design 47 G A-465), " +
"and answer which and how many bytes. An object a key names is never removed. Recorded as a hand act; assigner_inputs lists them as key-gone.",
Input: schema(map[string]string{"why": "why the objects of deleted keys are dropped now"}, []string{"why"}), Run: func(args map[string]any) (any, error) {
why := strings.TrimSpace(arg(args, "why"))
if why == "" {
return nil, errors.New("say why the objects of deleted keys are dropped")
}
taken, err := meshhandactsclient.Recorder{Ask: ask}.Record(meshhandactsclient.Request{What: inputsDropTool, Why: why + " (" + stdio.CallerOf(args) + ")", Cause: "inputs-drop"})
if err != nil {
return nil, fmt.Errorf("the hand act was not recorded, so nothing was removed: %w", err)
}
dropped, bytes, err := k.dropKeyGone()
out := []map[string]any{}
for _, o := range dropped {
out = append(out, map[string]any{"object": o.Name, "key": o.Key, "size": o.Size})
}
return map[string]any{"dropped": out, "count": len(out), "bytes": bytes, "hand-act": taken.Log}, err
}}
}
// heardStepEnded hands the end a build seat's step-ended names to the composition run of that ask (A-240, §719), which writes it
// in the run's key, and then deletes the input kept for the ask (design 47 G §354): the run's end first, so no other act delays
// it past its bound (A-470o, A-470p). One whose run's end cannot be written, or whose input cannot be deleted, is given again by
// the bus; its redelivery finds the run ended, said as ignored for the run, and still deletes the input.
func heardStepEnded(k *inputKeeper, runEnded func(buildstep.StepEnded) error, m jetstream.Msg, logf func(string, ...any)) {
var e buildstep.StepEnded
if err := json.Unmarshal(m.Data(), &e); err != nil {
logf("%s holds what is no step-ended, left: %v", m.Subject(), err)
_ = m.Ack()
return
}
if runEnded != nil {
if err := runEnded(e); err != nil {
logf("the composition run of the ask %s is not ended, so the bus gives its step-ended again: %v", e.Ask, err)
_ = m.Nak()
return
}
}
if err := k.ended(e.Ask); err != nil {
logf("inputs: the input of the ask %s could not be deleted, so the bus gives it again: %v", e.Ask, err)
_ = m.Nak()
return
}
_ = m.Ack()
}
@@ -0,0 +1,503 @@
package main
import (
"bytes"
"crypto/rand"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"sort"
"strings"
"sync"
"testing"
"time"
"github.com/nats-io/nats.go"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
"git.novox.be/novox/mesh-sdk/go/buscalls"
"git.novox.be/novox/mesh-sdk/go/stateobjects"
)
type kvMem struct {
mu sync.Mutex
vals map[string][]byte
revs map[string]uint64
// delErr, when set, fails the next Delete once.
delErr error
}
func newKVMem() *kvMem { return &kvMem{vals: map[string][]byte{}, revs: map[string]uint64{}} }
func (k *kvMem) Get(key string) (*stateobjects.Entry, error) {
k.mu.Lock()
defer k.mu.Unlock()
v, ok := k.vals[key]
if !ok {
return nil, nil
}
return &stateobjects.Entry{Value: v, Revision: k.revs[key]}, nil
}
func (k *kvMem) Create(key string, v []byte) error {
k.mu.Lock()
defer k.mu.Unlock()
if _, ok := k.vals[key]; ok {
return stateobjects.ErrChanged
}
k.vals[key], k.revs[key] = v, 1
return nil
}
func (k *kvMem) Update(key string, v []byte, rev uint64) error {
k.mu.Lock()
defer k.mu.Unlock()
if k.revs[key] != rev {
return stateobjects.ErrChanged
}
k.vals[key], k.revs[key] = v, rev+1
return nil
}
func (k *kvMem) Delete(key string) error {
k.mu.Lock()
defer k.mu.Unlock()
if err := k.delErr; err != nil {
k.delErr = nil
return err
}
delete(k.vals, key)
return nil
}
func (k *kvMem) Keys() ([]string, error) {
k.mu.Lock()
defer k.mu.Unlock()
var out []string
for key := range k.vals {
out = append(out, key)
}
sort.Strings(out)
return out, nil
}
type objectsMem struct {
mu sync.Mutex
objs map[string][]byte
listErr error // List fails with it
}
func (*objectsMem) MostBytes() int { return 0 }
func (o *objectsMem) Put(name string, data []byte) error {
o.mu.Lock()
defer o.mu.Unlock()
o.objs[name] = data
return nil
}
func (o *objectsMem) Get(name string) ([]byte, error) {
o.mu.Lock()
defer o.mu.Unlock()
d, ok := o.objs[name]
if !ok {
return nil, errors.New("no such object")
}
return d, nil
}
func (o *objectsMem) Delete(name string) error {
o.mu.Lock()
defer o.mu.Unlock()
delete(o.objs, name)
return nil
}
func (o *objectsMem) List() ([]stateobjects.Object, error) {
o.mu.Lock()
defer o.mu.Unlock()
if o.listErr != nil {
return nil, o.listErr
}
var out []stateobjects.Object
for n, d := range o.objs {
out = append(out, stateobjects.Object{Name: n, Size: int64(len(d))})
}
return out, nil
}
// lineMem is a core bus in memory: a chunk published is kept, and its acknowledgement heard at once.
type lineMem struct {
mu sync.Mutex
hear nats.MsgHandler
chunks map[string][]byte
}
func (l *lineMem) Publish(subject string, data []byte) error {
l.mu.Lock()
l.chunks[subject] = data
h := l.hear
l.mu.Unlock()
var c buscalls.SeatChunk
if err := json.Unmarshal(data, &c); err != nil {
return err
}
go h(&nats.Msg{Subject: buscalls.SeatChunks{Seat: meshwants.Seat, Verb: meshwants.VerbInput, Call: "0123456789abcdef"}.Ack(c.N)})
return nil
}
func (l *lineMem) Subscribe(_ string, fn nats.MsgHandler) (*nats.Subscription, error) {
l.mu.Lock()
l.hear = fn
l.mu.Unlock()
return nil, nil
}
func testKeeper(objs *objectsMem, now func() time.Time) *inputKeeper {
return &inputKeeper{vals: stateobjects.Values{KV: newKVMem(), Objects: objs, Store: "inputs-objects"}, now: now, logf: func(string, ...any) {}}
}
// Design 47 G §354, §712, A-237: an input of any size is kept as an object beside the state, and the seat mesh-wants' verb input
// answers it in chunks of at most 512 KiB, each acknowledged before the next.
func TestAnInputOverOneMiBIsKeptAsAnObjectAndAnsweredInChunks(t *testing.T) {
objs := &objectsMem{objs: map[string][]byte{}}
k := testKeeper(objs, time.Now)
body := make([]byte, 3<<20+17)
if _, err := rand.Read(body); err != nil {
t.Fatal(err)
}
digest, err := k.keep("ask-big", body)
if err != nil {
t.Fatal(err)
}
if len(objs.objs) != 1 {
t.Fatalf("a large input is one object beside the state, got %d", len(objs.objs))
}
if got, err := k.body(digest); err != nil || !bytes.Equal(got, body) {
t.Fatalf("the input read back: %d bytes, %v", len(got), err)
}
line := &lineMem{chunks: map[string][]byte{}}
verb := k.verb(line, time.Second)
raw, _ := json.Marshal(meshwants.InputInput{Digest: digest, Call: "0123456789abcdef"})
out, err := verb("", raw)
if err != nil {
t.Fatal(err)
}
ans := out.(meshwants.InputAnswer)
want := int64((len(body) + buscalls.SeatChunkBytes - 1) / buscalls.SeatChunkBytes)
if ans.Digest != digest || ans.Chunks != want || want < 6 {
t.Fatalf("the answer %+v, want %d chunks", ans, want)
}
send := buscalls.SeatChunks{Seat: meshwants.Seat, Verb: meshwants.VerbInput, Call: "0123456789abcdef"}
var got []byte
deadline := time.Now().Add(5 * time.Second)
for n := int64(1); n <= want; n++ {
for {
line.mu.Lock()
data, ok := line.chunks[send.Chunk(n)]
line.mu.Unlock()
if ok {
var c buscalls.SeatChunk
if err := json.Unmarshal(data, &c); err != nil || c.N != n || c.Of != want {
t.Fatalf("chunk %d: %+v, %v", n, c, err)
}
got = append(got, c.Data...)
break
}
if time.Now().After(deadline) {
t.Fatalf("chunk %d of %d never sent", n, want)
}
time.Sleep(time.Millisecond)
}
}
if !bytes.Equal(got, body) {
t.Error("the chunks do not carry the input's bytes")
}
if _, err := verb("", json.RawMessage(`{"digest":"`+strings.Repeat("b", 64)+`","call":"0123456789abcdef"}`)); err == nil {
t.Error("an input never kept is answered")
}
if _, err := verb("", json.RawMessage(`{"digest":"`+digest+`","call":"x"}`)); err == nil {
t.Error("a call of no token is answered")
}
// assigner_inputs lists it with its size and gives one whole by digest
list, err := inputsRead(k).Run(map[string]any{})
if err != nil || len(list.(map[string]any)["inputs"].([]inputSaid)) != 1 || list.(map[string]any)["inputs"].([]inputSaid)[0].Size != len(body) {
t.Errorf("assigner_inputs = %+v %v", list, err)
}
}
// §354: an input is deleted when the build seat's step-ended of its ask is heard, or a day after its write, judged at each new ask.
func TestAnInputIsDeletedAtItsStepEndedOrAfterADay(t *testing.T) {
now := time.Date(2026, 11, 12, 10, 0, 0, 0, time.UTC)
k := testKeeper(&objectsMem{objs: map[string][]byte{}}, func() time.Time { return now })
d1, err := k.keep("ask/one", []byte(`{"heads":"abc"}`))
if err != nil {
t.Fatal(err)
}
if _, err := k.body(d1); err != nil {
t.Fatalf("a kept input is not read: %v", err)
}
if err := k.ended("ask/other"); err != nil {
t.Fatal(err)
}
if _, err := k.body(d1); err != nil {
t.Fatalf("the step-ended of another ask deleted it: %v", err)
}
if err := k.ended("ask/one"); err != nil {
t.Fatal(err)
}
if _, err := k.body(d1); err == nil {
t.Error("the input of an ended ask is still answered")
}
if keys, _ := k.vals.KV.Keys(); len(keys) != 0 {
t.Errorf("keys left after the step-ended: %v", keys)
}
d2, _ := k.keep("ask/two", []byte(`{"heads":"def"}`))
now = now.Add(25 * time.Hour)
if _, err := k.keep("ask/three", []byte(`{"heads":"ghi"}`)); err != nil {
t.Fatal(err)
}
if _, err := k.body(d2); err == nil {
t.Error("an input a day old is still kept at the next ask")
}
// A-470o, A-470p: the step-ended's run end is written before the input is deleted; a delete that fails asks the event again,
// whose redelivery finds the run ended and still deletes the input; a run end not written asks it again with the input kept.
for _, c := range []struct {
name string
delErr error
runErr error
naked bool
runs int
deleted bool
}{
{name: "the run's end before the input's delete", runs: 1, deleted: true},
{name: "an input not deleted asks the event again", delErr: errors.New("the bus is away"), naked: true, runs: 2, deleted: true},
{name: "a run's end not written asks the event again", runErr: errors.New("the run is not read"), naked: true, runs: 1},
} {
t.Run(c.name, func(t *testing.T) {
k := testKeeper(&objectsMem{objs: map[string][]byte{}}, time.Now)
d, _ := k.keep("ask/run", []byte(`{"heads":"abc"}`))
k.vals.KV.(*kvMem).delErr = c.delErr
runs := 0
runEnded := func(e buildstep.StepEnded) error {
runs++
if _, err := k.body(d); err != nil {
t.Errorf("the run's end is written after the input's delete (%d)", runs)
}
return c.runErr
}
raw, _ := json.Marshal(buildstep.StepEnded{Ask: "ask/run"})
m := &heardMsg{data: raw, subject: "step-ended"}
heardStepEnded(k, runEnded, m, t.Logf)
if m.naked != c.naked || m.acked == c.naked {
t.Fatalf("acked %v, naked %v, want naked %v", m.acked, m.naked, c.naked)
}
if m.naked && c.delErr != nil { // the redelivery
m = &heardMsg{data: raw, subject: "step-ended"}
heardStepEnded(k, func(e buildstep.StepEnded) error { runs++; return nil }, m, t.Logf)
}
if _, err := k.body(d); runs != c.runs || (err != nil) != c.deleted {
t.Errorf("the run's end heard %d times (want %d), the input deleted %v (want %v)", runs, c.runs, err != nil, c.deleted)
}
})
}
}
// Design 47 G A-465: an input the assigner ends itself (the step-ended of its ask, the sweep of a day-old key) ends its object
// too; the objects of keys another part deleted are removed by dropKeyGone and by the tool assigner_inputs_drop, which lists
// them as key-gone first, and never removes an object a key names.
func TestAnEndedInputEndsItsObjectAndTheDropToolRemovesWhatAKeyLeft(t *testing.T) {
now := time.Date(2026, 11, 17, 10, 0, 0, 0, time.UTC)
objs := &objectsMem{objs: map[string][]byte{}}
k := testKeeper(objs, func() time.Time { return now })
big := func(b byte) []byte { return bytes.Repeat([]byte{b}, 2<<20) }
if _, err := k.keep("ask-one", big('a')); err != nil {
t.Fatal(err)
}
if _, err := k.keep("ask-two", big('b')); err != nil {
t.Fatal(err)
}
if len(objs.objs) != 2 {
t.Fatalf("objects = %d, want 2", len(objs.objs))
}
if err := k.ended("ask-one"); err != nil || len(objs.objs) != 1 {
t.Fatalf("the step-ended left %d objects (%v), want 1", len(objs.objs), err)
}
now = now.Add(25 * time.Hour)
if _, err := k.keep("ask-three", big('c')); err != nil {
t.Fatal(err)
}
if len(objs.objs) != 1 {
t.Fatalf("after the sweep of the day-old input %d objects, want only the new one", len(objs.objs))
}
// An object whose key another part deleted is listed as key-gone and removed by the tool; a live one stays.
keys, _ := k.vals.KV.Keys()
for _, key := range keys {
if !strings.HasPrefix(key, inputsAskPrefix) {
if err := k.vals.KV.Delete(key); err != nil {
t.Fatal(err)
}
}
}
live := []byte(`{"heads":"x"}`)
if _, err := k.keep("ask-four", append(live, make([]byte, 2<<20)...)); err != nil {
t.Fatal(err)
}
list, err := inputsRead(k).Run(map[string]any{})
if err != nil || len(list.(map[string]any)["key-gone"].([]map[string]any)) != 1 {
t.Fatalf("assigner_inputs key-gone = %+v %v, want the one object of the deleted key", list, err)
}
ask := func(string, any) (json.RawMessage, error) {
return json.RawMessage(`{"answer":{"log":"hand-acts"}}`), nil
}
if _, err := inputsDrop(k, ask).Run(map[string]any{}); err == nil {
t.Error("dropped with no reason")
}
out, err := inputsDrop(k, ask).Run(map[string]any{"why": "a key left its object"})
if err != nil || out.(map[string]any)["count"] != 1 || len(objs.objs) != 1 {
t.Fatalf("assigner_inputs_drop = %+v %v, %d objects left: want one removed and the live one kept", out, err, len(objs.objs))
}
// The start drops what a key left, said with its count and bytes.
if _, err := k.keep("ask-five", live); err != nil {
t.Fatal(err)
}
for _, key := range keysOf(t, k) {
if !strings.HasPrefix(key, inputsAskPrefix) {
_ = k.vals.KV.Delete(key)
}
}
var logged []string
k.logf = func(f string, a ...any) { logged = append(logged, fmt.Sprintf(f, a...)) }
before := len(objs.objs)
k.dropAtStart()
if len(objs.objs) != 0 || before == 0 || len(logged) != 1 || !strings.Contains(logged[0], fmt.Sprintf("%d objects of deleted keys removed at the start", before)) || !strings.Contains(logged[0], " bytes") {
t.Errorf("the start left %d of %d objects and said %q: want every key-gone object removed and its count and bytes said", len(objs.objs), before, logged)
}
}
func keysOf(t *testing.T, k *inputKeeper) []string {
t.Helper()
keys, err := k.vals.KV.Keys()
if err != nil {
t.Fatal(err)
}
return keys
}
// Design 47 G A-465: assigner_inputs says why key-gone objects are not known when the objects cannot be listed, and never
// answers them as none.
func TestAssignerInputsSaysWhenTheKeyGoneObjectsCannotBeListed(t *testing.T) {
objs := &objectsMem{objs: map[string][]byte{}, listErr: errors.New("the object store does not answer")}
k := testKeeper(objs, time.Now)
out, err := inputsRead(k).Run(map[string]any{})
if err != nil {
t.Fatal(err)
}
m := out.(map[string]any)
if msg, _ := m["key-gone-error"].(string); !strings.Contains(msg, "does not answer") {
t.Errorf("answer %+v: want key-gone-error naming the failure", m)
}
if _, has := m["key-gone"]; has {
t.Errorf("answer %+v: an unreadable store is not answered as no key-gone objects", m)
}
}
// Design 47 G A-465a: an input is kept once per content under its sha256 alone; every ask names the digest it uses, and the input
// goes, with its object, at the step-ended of the last ask that names it, or a day after its last write; a request the cap still
// refuses says the fill; an input of the old form (a key that is no digest) is ended with its object.
func TestAnInputIsKeptOncePerContentAndEndsWithItsLastAsk(t *testing.T) {
now := time.Date(2026, 11, 17, 10, 0, 0, 0, time.UTC)
objs := &objectsMem{objs: map[string][]byte{}}
k := testKeeper(objs, func() time.Time { return now })
body := bytes.Repeat([]byte{'n'}, 2<<20)
var digests []string
for _, ask := range []string{"ask-1", "ask-2", "ask-3"} {
d, err := k.keep(ask, body)
if err != nil {
t.Fatal(err)
}
digests = append(digests, d)
}
if digests[0] != digestOf(body) || digests[1] != digests[0] || digests[2] != digests[0] {
t.Fatalf("digests = %v, want the sha256 of the bytes each time", digests)
}
if _, err := k.vals.KV.Get(digests[0]); err != nil {
t.Fatal(err)
}
if e, _ := k.vals.KV.Get(digests[0]); e == nil || len(objs.objs) != 1 {
t.Fatalf("one key by the digest and one object wanted, got entry %v and %d objects", e, len(objs.objs))
}
for _, key := range keysOf(t, k) {
if !strings.HasPrefix(key, inputsAskPrefix) && key != digests[0] {
t.Errorf("a key %q beside the one input", key)
}
}
if e, _ := k.vals.KV.Get(inputsAskPrefix + "ask-2"); e == nil || !strings.Contains(string(e.Value), digests[0]) || !strings.Contains(string(e.Value), "20261117T100000Z") {
t.Errorf("the ask does not name the digest it uses: %v", e)
}
for _, ask := range []string{"ask-1", "ask-2"} {
if err := k.ended(ask); err != nil {
t.Fatal(err)
}
if _, err := k.body(digests[0]); err != nil {
t.Fatalf("the input went at the end of %s while ask-3 still names it: %v", ask, err)
}
}
if err := k.ended("ask-3"); err != nil {
t.Fatal(err)
}
if _, err := k.body(digests[0]); err == nil || len(objs.objs) != 0 || len(keysOf(t, k)) != 0 {
t.Errorf("the last step-ended left the input (%v), %d objects, keys %v", err, len(objs.objs), keysOf(t, k))
}
// a day after its last write, a renewed write counted
if _, err := k.keep("ask-4", body); err != nil {
t.Fatal(err)
}
now = now.Add(20 * time.Hour)
if _, err := k.keep("ask-5", body); err != nil {
t.Fatal(err)
}
now = now.Add(20 * time.Hour)
if _, err := k.keep("ask-6", []byte("other")); err != nil {
t.Fatal(err)
}
if _, err := k.body(digests[0]); err != nil {
t.Errorf("an input written again 20 hours ago was swept: %v", err)
}
now = now.Add(25 * time.Hour)
if _, err := k.keep("ask-7", []byte("another")); err != nil {
t.Fatal(err)
}
if _, err := k.body(digests[0]); err == nil || len(objs.objs) != 0 {
t.Errorf("an input a day after its last write is kept (%v), %d objects", err, len(objs.objs))
}
// an input of the old form goes a day after the time its key carries, with its object, never earlier
old := "20261117T090000Z." + digestOf([]byte("old"))
if err := k.vals.Put(old, base64.StdEncoding.EncodeToString(bytes.Repeat([]byte{'o'}, 2<<20))); err != nil {
t.Fatal(err)
}
recent := now.Add(-time.Hour).Format(inputsTime) + "." + digestOf([]byte("recent"))
if err := k.vals.Put(recent, "cmVjZW50"); err != nil {
t.Fatal(err)
}
if err := k.sweep(); err != nil {
t.Fatal(err)
}
if e, _ := k.vals.KV.Get(old); e != nil || len(objs.objs) != 0 {
t.Errorf("the input of the old form is kept (%v) with %d objects", e, len(objs.objs))
}
if e, _ := k.vals.KV.Get(recent); e == nil {
t.Error("an input of the old form under a day old was deleted early")
}
// a new content the cap refuses says the fill; the same content, already kept, needs no room
full := newTestKeeperWithFill(objs, now, inputsCap-10)
if _, err := full.keep("ask-8", []byte("fits")); err != nil {
t.Fatalf("a content that fits is refused: %v", err)
}
if _, err := full.keep("ask-9", []byte("does not fit at all")); err == nil || !strings.Contains(err.Error(), "bytes kept") {
t.Errorf("the refusal does not name the fill: %v", err)
}
if _, err := full.keep("ask-10", []byte("fits")); err != nil {
t.Errorf("the content already kept is refused at the cap: %v", err)
}
}
func newTestKeeperWithFill(objs *objectsMem, now time.Time, used int64) *inputKeeper {
k := testKeeper(objs, func() time.Time { return now })
k.used = func() (int64, error) { return used, nil }
return k
}
File diff suppressed because it is too large Load Diff
@@ -8,15 +8,22 @@ package main
import (
"context"
"errors"
"fmt"
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/nodebuildgo"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
"git.novox.be/novox/mesh-sdk/go/buscalls"
"io"
"log"
"maps"
"mesh-delivery-assigner/internal/assigngraph"
"mesh-delivery-assigner/internal/assignment"
"mesh-delivery-assigner/internal/buckets"
"os"
"os/signal"
"slices"
"strings"
"syscall"
"time"
@@ -24,9 +31,11 @@ import (
"github.com/nats-io/nats.go/jetstream"
mma "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
mcc "git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient"
mcseat "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions"
occ "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/clients/operatorchannelclient"
oc "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/seats/operatorchannel"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-sdk/go/announce"
"git.novox.be/novox/mesh-sdk/go/process"
"git.novox.be/novox/mesh-sdk/go/seatlist"
@@ -38,6 +47,9 @@ import (
plc "mesh-delivery-assigner/internal/assignment"
)
// composeCallBound is how long the program's calls wait for an answer (main).
const composeCallBound = 3 * time.Minute
func main() {
if os.Getenv(process.BrokerFileEnv) == "" {
// Started by the tool runner, with no credential of its own: the put's tools (ADR 0546), served through the runtime,
@@ -48,6 +60,10 @@ func main() {
}
return
}
// A call waits up to composeCallBound for its answer: compose-candidate composes a whole revision in shadow on each node and
// answered in about 34 s on g14 and shanks (2026-11-16 23:27), past the SDK's 30 s, so every composition step could not run.
// A responder that is absent still answers at once. To be replaced by a bound per verb from the seat's definition.
process.CallTimeout = composeCallBound
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
if err := run(ctx, os.Getenv, os.Stderr); err != nil {
@@ -60,13 +76,8 @@ func main() {
// holds the two lists equal), so the controller's broker grants exactly these.
var readBuckets = []string{
buckets.Grants,
buckets.Answers,
buckets.Builds,
buckets.Presence,
buckets.Have,
buckets.Provisions,
buckets.Source,
buckets.Merges,
}
// readFamilies are the states kept one bucket per node the assigner reads, each named in its manifest's reads: every
@@ -75,22 +86,29 @@ var readFamilies = []string{buckets.ComposedRead}
// ownBuckets are the assigner's own states, as its manifest declares them: the seat mesh-module-assigner's three among them
// (ADR 0567 §1), named after the assigner as every module state is.
var ownBuckets = []string{buckets.Asks, buckets.Differences,
buckets.Puts, buckets.Wants, plc.AssignmentsBucket, plc.ProposalsBucket,
plc.CandidatesBucket, plc.PulsesBucket, assign.FindingsBucket, assign.PoliciesBucket, plc.SeatHoldersBucket,
engineReadsBucket, retiredBucket, copiesBucket}
func ownBuckets() []string {
return []string{buckets.Asks(), buckets.Differences(),
buckets.Puts(), buckets.Wants(), plc.AssignmentsBucket(), plc.ProposalsBucket(),
plc.CandidatesBucket(), plc.PulsesBucket(), assign.FindingsBucket(), assign.PoliciesBucket(), plc.SeatHoldersBucket(),
engineReadsBucket(), retiredBucket(), copiesBucket(), writtenBucket(), buckets.Waits(), buckets.PutWaits(), buckets.DeliveryWaits(), buckets.DeliveredAgain(), buckets.Inputs(), buckets.CompositionRuns(), pinsBucket()}
}
// engineReadsState is the assigner's state of what each node's engine states it reads (ADR 0618 §3), one key `<node>`, as
// the verb manifest-reads last answered it or the fallback read it: what assigner_engine_reads lists and asks again.
const engineReadsState = "engine-reads"
// engineReadsBucket is that state's bucket.
const engineReadsBucket = assignment.Module + "_" + engineReadsState
func engineReadsBucket() string { return assignment.Module() + "_" + engineReadsState }
// writtenBucket is the bucket of the state written (pipelines.go): the pipeline ends the wants follow.
func writtenBucket() string { return assignment.Module() + "_" + writtenState }
// seatBuckets are the seat's states, new with it: until the controller has made them from the manifest and the bus grants
// them, the assigner starts without them and binds each once the bus says it was created (issue 1790's kind).
var seatBuckets = []string{plc.AssignmentsBucket, plc.ProposalsBucket, plc.CandidatesBucket,
plc.PulsesBucket, copiesBucket}
func seatBuckets() []string {
return []string{plc.AssignmentsBucket(), plc.ProposalsBucket(), plc.CandidatesBucket(),
plc.PulsesBucket(), copiesBucket()}
}
// keptStates is what the assigner keeps and who may read it (ADR 0495 §2-§3): its wants by the watchman and the view
// (and the node agent from release 6), its differences by the view, its asks by the view
@@ -106,7 +124,7 @@ var keptStates = []announce.State{
{Name: "differences", Readable: true},
{Name: "puts", Readable: true},
{Name: "wants", Readable: true},
{Name: mcc.FindingsState, Readable: true},
{Name: assign.FindingsState, Readable: true},
{Name: buckets.PoliciesState, Readable: true},
{Name: mma.StateSeatHolders, Readable: true},
{Name: views.MarksState, Readable: true}, // what its views family said each state up to (views.go)
@@ -114,6 +132,14 @@ var keptStates = []announce.State{
{Name: engineReadsState, Readable: true},
{Name: retiredState}, // read only by the copy into assignments (migrate.go)
{Name: copiesState, Readable: true},
{Name: writtenState, Readable: true},
{Name: buckets.WaitsState, Readable: true},
{Name: buckets.PutWaitsState, Readable: true}, // the put waits said (putwaits.go, design 47 G A-211)
{Name: buckets.DeliveryWaitsState, Readable: true}, // the delivery waits said (delivered.go, design 47 G A-246)
{Name: buckets.DeliveredAgainState, Readable: true}, // the asks of assigner_delivered_again (delivered.go, design 47 G A-250)
{Name: buckets.InputsState, Readable: true}, // read by the tool process alone: the verb input and assigner_inputs (design 47 G §354)
{Name: buckets.CompositionRunsState, Readable: true}, // the composition runs, read by the process and its tools (design 47 G §719, A-468c)
{Name: pinsState, Readable: true}, // the records pinning each assignment graph revision (design 47 G §579)
}
// kvSet is every bucket the assigner opened, by name.
@@ -125,18 +151,18 @@ type kvSet map[string]jetstream.KeyValue
// without it and takes no put further until it starts again (ADR 0546).
func open(ctx context.Context, js process.BucketOpener, logf func(string, ...any)) (kvSet, error) {
out := kvSet{}
for _, name := range append(append([]string{}, readBuckets...), ownBuckets...) {
for _, name := range append(append([]string{}, readBuckets...), ownBuckets()...) {
kv, err := js.KeyValue(ctx, name)
if name == buckets.Puts && err != nil {
if name == buckets.Puts() && err != nil {
logf("the bucket %s cannot be opened (%v): no put is taken further until the assigner starts again", name, err)
continue
}
if slices.Contains(seatBuckets, name) && err != nil {
if slices.Contains(seatBuckets(), name) && err != nil {
// The seat's states come in the same delivery as this assigner (ADR 0567 §1): without assignments no module is placed.
logf("the bucket %s cannot be opened (%v): it is bound once the bus says it was made", name, err)
continue
}
if name == plc.SeatHoldersBucket && err != nil {
if name == plc.SeatHoldersBucket() && err != nil {
// The seat's state, new with ADR 0571 §4: bound once the bus says it was made; until then nobody is told who
// holds which seat here, and the controller's seats still answer.
logf("the bucket %s cannot be opened (%v): it is bound once the bus says it was made", name, err)
@@ -148,31 +174,56 @@ func open(ctx context.Context, js process.BucketOpener, logf func(string, ...any
logf("the bucket %s cannot be opened (%v): it is bound once the bus says it was made", name, err)
continue
}
if name == assign.PoliciesBucket && err != nil {
if name == assign.PoliciesBucket() && err != nil {
// The seat mesh-wants' state, new with it (ADR 0565 §7): bound once the bus says it was made; until then no
// person's policy is read, so the controller's beside each composition holds, as before.
logf("the bucket %s cannot be opened (%v): it is bound once the bus says it was made", name, err)
continue
}
if name == assign.FindingsBucket && err != nil {
if name == assign.FindingsBucket() && err != nil {
// New with health leaving the controller (issue 1952 WM6): without it the conditions are said straight to the
// router and kept as no finding.
logf("the bucket %s cannot be opened (%v): the assigner's conditions are said straight to the router until it starts again", name, err)
continue
}
if (name == buckets.Source || name == buckets.Merges) && err != nil {
// The gate's source and merges (ADR 0601 §1): without them no release is known to carry a build, so every move of
// a record module is asked of a person, as before.
logf("the bucket %s cannot be opened (%v): no release's Approve answers a record ask until it is bound", name, err)
continue
}
if name == engineReadsBucket && err != nil {
if name == engineReadsBucket() && err != nil {
// New with ADR 0618 §3: without it the statements the verb answers are kept in memory only, and
// assigner_engine_reads lists nothing.
logf("the bucket %s cannot be opened (%v): what each node's engine reads is kept in memory only until it starts again", name, err)
continue
}
if name == retiredBucket && err != nil {
if name == buckets.Inputs() && err != nil {
// New with the verb input (design 47 G §354): only the tool process reads it, so the program starts without it.
logf("the bucket %s cannot be opened (%v): it is read by the tool process alone", name, err)
continue
}
if name == pinsBucket() && err != nil {
// New with the pins (design 47 G §579): without it no pin is kept and no revision is removed.
logf("the bucket %s cannot be opened (%v): no pin is kept and no revision removed until it starts again", name, err)
continue
}
if name == buckets.Waits() && err != nil {
// New with the wait on an outside cause (design 47 G §706): without it no wait is made, and a failing check is judged
// as before.
logf("the bucket %s cannot be opened (%v): no outside wait is kept until the assigner starts again", name, err)
continue
}
if name == buckets.DeliveredAgain() && err != nil {
// New with A-250: without it assigner_delivered_again is not taken until the assigner starts again.
logf("the bucket %s cannot be opened (%v): no version is said delivered again until the assigner starts again", name, err)
continue
}
if name == buckets.DeliveryWaits() && err != nil {
// New with A-246: without it no dependent waits for its dependency's delivery until the assigner starts again.
logf("the bucket %s cannot be opened (%v): no delivery wait is kept until the assigner starts again", name, err)
continue
}
if name == buckets.PutWaits() && err != nil {
// New with A-211: without it no put's wait is said until the assigner starts again.
logf("the bucket %s cannot be opened (%v): no put's wait is said until the assigner starts again", name, err)
continue
}
if name == retiredBucket() && err != nil {
// The retired state is read only for the copy into `assignments` (migrate.go): a mesh made after the switch has
// none, and nothing is copied.
logf("the bucket %s cannot be opened (%v): nothing is copied from it", name, err)
@@ -195,11 +246,11 @@ func open(ctx context.Context, js process.BucketOpener, logf func(string, ...any
// states and those new with a delivery of their own, bound once made, and the two that choose the grants' source.
func startsWithout(name string) bool {
switch name {
case plc.SeatHoldersBucket, buckets.Provisions, assign.PoliciesBucket, assign.FindingsBucket,
buckets.Puts, buckets.Source, buckets.Merges, engineReadsBucket, retiredBucket:
case plc.SeatHoldersBucket(), buckets.Provisions, assign.PoliciesBucket(), assign.FindingsBucket(),
buckets.Puts(), engineReadsBucket(), retiredBucket(), writtenBucket(), buckets.Waits(), buckets.PutWaits(), buckets.DeliveryWaits(), buckets.DeliveredAgain(), buckets.Inputs(), pinsBucket():
return true
}
return slices.Contains(seatBuckets, name) || name == buckets.Grants
return slices.Contains(seatBuckets(), name) || name == buckets.Grants
}
// run is the program: it returns when ctx ends or the bus cannot be used.
@@ -209,6 +260,7 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro
if err != nil {
return err
}
plc.SetModule(account.Module) // the assigner names its own states from its credential's module (A-296, §428)
conn, js, err := account.Dial()
if err != nil {
return err
@@ -230,11 +282,14 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro
}
thisNode = account.Node
logger.Printf("started on the account %s, reading %d buckets", account.User, len(kvs))
findings := findingsOf(ctx, kvs, logger.Printf)
findings, writer := findingsOf(ctx, account, conn, js, said, kvs, logger.Printf)
if writer != nil {
defer writer.Close()
}
// Each change of the states its readers read is said on its views family (ADR 0615 §5, ADR 0619 §2); a watch of it
// that ends stops the program, as a watch of what a pass reads does.
viewErrs := make(chan error, len(viewedStates))
startViews(ctx, js, conn, account, kvs, findings, viewErrs, logger.Printf)
viewErrs := make(chan error, len(viewedStates()))
startViews(ctx, js, conn, account, kvs, wireOf(writer), viewErrs, logger.Printf)
go func() {
select {
case <-ctx.Done():
@@ -243,27 +298,66 @@ func run(ctx context.Context, getenv func(string) string, logOut io.Writer) erro
conn.Close()
}
}()
iv := &indexerViews{js: js, account: account, call: said.Call, findings: findings, logf: logger.Printf,
status: process.AwaitBucket(ctx, js, conn, firstViewsBucket, "assigner_first_views reads nothing and assigner_first_view_again is not heard", logger.Printf)}
return follow(ctx, js, conn, kvs, findings.Say(sayVia(ctx, js)), findings, emitting{said}, iv, logger)
iv := &catalogViews{js: js, account: account, call: said.Call, writer: wireOf(writer), logf: logger.Printf,
status: process.AwaitBucket(ctx, js, conn, firstViewsBucket(), "assigner_first_views reads nothing and assigner_first_view_again is not heard", logger.Printf)}
// The inputs of the composition steps it asks a build seat to run: the seat mesh-wants' verb input is answered here in chunks
// of the core connection, of any size (design 47 G §354, §712, A-237).
inputs := inputsOver(kvs[buckets.Inputs()], js, account.Module, logger.Printf)
// The seat list (seatlist.go), followed in follow over the connection and the hub: the verb input's callers are checked
// against the seat's definition it holds (A-186).
gate := seatlist.NewPart("assigner", seatListAgainCallers)
if inputs != nil {
inputs.dropAtStart() // the objects of keys another part deleted (A-465)
stopInput, err := said.AnswerSeat(meshwants.Seat, seatlist.Definition(gate.Reader, meshwants.Seat), map[string]process.SeatHandler{meshwants.VerbInput: inputs.verb(conn, buscalls.SeatAckWithin)})
if err != nil {
return fmt.Errorf("answering the verb input: %w", err)
}
defer stopInput()
}
return follow(ctx, js, conn, kvs, findings.Say(sayVia(ctx, js)), findings, emitting{said}, iv, inputs, gate, logger, getenv)
}
// findingsOf is where the assigner's said conditions go as findings (issue 1952 WM6): its findings bucket, which the
// condition keeper carries (novox/hq ADR 0590 §3). Without it the conditions are said straight to the router.
func findingsOf(ctx context.Context, kvs kvSet, logf func(string, ...any)) assign.Findings {
func findingsOf(ctx context.Context, account process.Account, conn *nats.Conn, js jetstream.JetStream, said *process.Conn, kvs kvSet, logf func(string, ...any)) (assign.Findings, *heldWriter) {
var f assign.Findings
if kv := kvs[assign.FindingsBucket]; kv != nil {
f.Put = func(key string, value []byte) error { _, err := kv.Put(ctx, key, value); return err }
f.Delete = func(key string) error { return kv.Delete(ctx, key) }
f.Keys = func() ([]string, error) {
keys, err := kv.Keys(ctx)
if errors.Is(err, jetstream.ErrNoKeysFound) {
return nil, nil
}
return keys, err
}
if kvs[assign.FindingsBucket()] == nil {
return f, nil
}
return f
state := said.State(assign.FindingsState)
w, err := views.NewHeldWriter(views.WriterConfig[mcseat.Finding, mcseat.FindingCleared, mcseat.FindingsStated, mcseat.FindingsAskedEvent]{
Module: account.Module, State: state, Node: account.Node, Asked: mcseat.SubjectFindingsAsked, JS: js, Conn: conn, Logf: logf})
if err != nil {
logf("the assigner's finding writer cannot be made, so its findings are not written: %v", err)
return f, nil
}
// A writer that cannot start (the stream of its asks is not there yet) is said; its findings are then kept in the
// state alone and said by the next start (as the node-engine's is).
if err := w.Start(ctx); err != nil {
logf("the finding writer cannot start, its findings are kept in the state alone: %v", err)
}
f.Put = func(x mcseat.Finding) error { return w.Write(ctx, x) }
f.Delete = func(key string) error {
scope, rest, _ := strings.Cut(key, ".")
i := strings.LastIndex(rest, ".")
if i < 0 {
return fmt.Errorf("%q is no finding's key", key)
}
return w.Clear(ctx, scope, rest[:i], rest[i+1:], "the assigner no longer observes it")
}
f.Keys = state.Keys
return f, w
}
// heldWriter is the assigner's finding writer: its findings are raised as they happen, so the writer holds them (design 47 G A-29).
type heldWriter = views.HeldWriter[mcseat.Finding, mcseat.FindingCleared, mcseat.FindingsStated, mcseat.FindingsAskedEvent]
// wireOf is w as the views parts' finding writer; nil when the assigner has none, so no part writes through a nil writer.
func wireOf(w *heldWriter) views.WireWriter {
if w == nil {
return nil
}
return w
}
// thisNode is the node this process runs on, as its credential names it: said with each of the seat's events.
@@ -274,34 +368,43 @@ type emitting struct{ *process.Conn }
func (e emitting) Emit(eventType string, body any) error { return e.Conn.Emit(eventType, body) }
// optionalEnds is what stops when the watch of a bucket that never gates the first pass ends.
func optionalEnds() map[string]string {
return map[string]string{buckets.Puts(): "no put is taken further", buckets.Answers: "no ask is answered"}
}
// watched are the buckets whose every value a pass reads; the manifests are read by digest when a pass needs one, and
// watched only for keys, so a manifest that arrives wakes a composition that waits for it.
var watched = []string{
buckets.Grants,
buckets.Answers,
buckets.Builds,
plc.AssignmentsBucket,
plc.ProposalsBucket,
plc.CandidatesBucket,
plc.PulsesBucket,
copiesBucket,
buckets.Presence,
buckets.Have,
buckets.Asks,
buckets.Differences,
buckets.Wants,
assign.PoliciesBucket,
buckets.Provisions,
plc.SeatHoldersBucket,
buckets.Source,
buckets.Merges,
engineReadsBucket,
func watched() []string {
return []string{
buckets.Grants,
plc.AssignmentsBucket(),
plc.ProposalsBucket(),
plc.CandidatesBucket(),
plc.PulsesBucket(),
copiesBucket(),
buckets.Have,
buckets.Asks(),
buckets.Differences(),
buckets.Wants(),
assign.PoliciesBucket(),
buckets.Provisions,
plc.SeatHoldersBucket(),
engineReadsBucket(),
writtenBucket(),
buckets.Waits(),
buckets.PutWaits(),
buckets.DeliveryWaits(),
buckets.DeliveredAgain(), // its watch wakes a pass at once on an ask of assigner_delivered_again (A-250)
}
}
// follow watches every bucket a pass reads and makes a pass at start, once every watch handed what stands, and after
// each change; changes that come during a pass make one more. It returns when ctx ends or a watch ends.
func follow(ctx context.Context, js jetstream.JetStream, nc process.Subscriber, kvs kvSet, say func(oc.Condition) error, findings assign.Findings, bus caller, iv *indexerViews, logger *log.Logger) error {
func follow(ctx context.Context, js jetstream.JetStream, nc process.Subscriber, kvs kvSet, say func(oc.Condition) error, findings assign.Findings, bus caller, iv *catalogViews, inputs *inputKeeper, gate *seatlist.Part, logger *log.Logger, getenv func(string) string) error {
w := newWorld()
// The callers' seat entries are resolved from the assigner's own seat-holders as it last read them (A-298).
gate.Holders(seatlist.HoldersIn(func() (map[string][]byte, error) { return w.read(plc.SeatHoldersBucket()), nil }))
dirty := make(chan struct{}, 1)
wake := func() {
select {
@@ -309,15 +412,16 @@ func follow(ctx context.Context, js jetstream.JetStream, nc process.Subscriber,
default:
}
}
errs := make(chan error, len(watched)+2)
settled := make(chan struct{}, len(watched)+2)
errs := make(chan error, len(watched())+2)
settled := make(chan struct{}, len(watched())+2)
// What each node's engine reads (ADR 0618 §3, §4): asked through the seat's verb, kept in the state engine-reads, read
// from the node's record where the engine does not answer (the fallback, said in the journal).
reads := &enginereads.Keeper{Fallback: w.recordReads, Changed: wake, Logf: logger.Printf}
if bus != nil {
reads.Call = bus.CallOn
reads.Call = bus.CallKeptOn // a kept call, called again through a transport fault (ADR 0668 §1)
reads.Once = bus.CallOn // its fault keeps the fallback at once while the kept call asks on (ADR 0668 §3)
}
if kv := kvs[engineReadsBucket]; kv != nil {
if kv := kvs[engineReadsBucket()]; kv != nil {
reads.Put = func(node string, v []byte) error { _, err := kv.Put(ctx, node, v); return err }
reads.Delete = func(node string) error { return kv.Delete(ctx, node) }
}
@@ -327,7 +431,7 @@ func follow(ctx context.Context, js jetstream.JetStream, nc process.Subscriber,
return fmt.Errorf("the bucket %s cannot be watched: %w", name, err)
}
// The puts' watch never stops the wants (ADR 0546): when it ends, the puts are no longer heard, said in the journal.
optional := name == buckets.Puts
optional := name == buckets.Puts() || name == buckets.Answers
go func() {
defer kw.Stop()
for {
@@ -338,7 +442,7 @@ func follow(ctx context.Context, js jetstream.JetStream, nc process.Subscriber,
case e, ok := <-kw.Updates():
if !ok {
if optional {
logger.Printf("the watch of %s ended: no put is taken further until the assigner starts again", name)
logger.Printf("the watch of %s ended: %s until the assigner starts again", name, optionalEnds()[name])
return
}
errs <- fmt.Errorf("the watch of %s ended", name)
@@ -354,7 +458,7 @@ func follow(ctx context.Context, js jetstream.JetStream, nc process.Subscriber,
if e.Operation() == jetstream.KeyValuePut {
value = e.Value()
}
if name == engineReadsBucket {
if name == engineReadsBucket() {
reads.Heard(e.Key(), value, value == nil) // it wakes a pass when a statement changed
continue
}
@@ -367,10 +471,10 @@ func follow(ctx context.Context, js jetstream.JetStream, nc process.Subscriber,
}
// The puts' watch is not waited for before the first pass: a watch of them that ends before it handed what stands only
// stops the puts, never the wants.
if kvs[buckets.Puts] != nil {
if err := watch(buckets.Puts); err != nil {
if kvs[buckets.Puts()] != nil {
if err := watch(buckets.Puts()); err != nil {
logger.Printf("%v: no put is taken further until it is opened again", err)
delete(kvs, buckets.Puts)
delete(kvs, buckets.Puts())
}
}
// The puts' bucket is made by the controller from the manifest's states at its start (ADR 0201), and the assigner's
@@ -379,34 +483,34 @@ func follow(ctx context.Context, js jetstream.JetStream, nc process.Subscriber,
// further, without a restart.
var triedPuts time.Time
reopenPuts := func(p *passer) {
if kvs[buckets.Puts] != nil || time.Since(triedPuts) < PutsReopenEvery {
if kvs[buckets.Puts()] != nil || time.Since(triedPuts) < PutsReopenEvery {
return
}
triedPuts = time.Now()
kv, err := js.KeyValue(ctx, buckets.Puts)
kv, err := js.KeyValue(ctx, buckets.Puts())
if err != nil {
return
}
kvs[buckets.Puts] = kv
if err := watch(buckets.Puts); err != nil {
kvs[buckets.Puts()] = kv
if err := watch(buckets.Puts()); err != nil {
logger.Printf("%v: no put is taken further until it is opened again", err)
delete(kvs, buckets.Puts)
delete(kvs, buckets.Puts())
return
}
if bus != nil {
p.acts = newPutActs(bus, wake, logger.Printf)
}
logger.Printf("the bucket %s is open: puts are taken further", buckets.Puts)
logger.Printf("the bucket %s is open: puts are taken further", buckets.Puts())
}
started := 0
for _, name := range watched {
for _, name := range watched() {
if kvs[name] == nil && startsWithout(name) {
continue // not on the bus at this start (open said so)
}
started++
var opts []jetstream.WatchOpt
if name == buckets.Have || name == buckets.Source {
// what each node ran healthy before, for a set-back; and the release behind each source revision (ADR 0601 §1)
if name == buckets.Have {
// what each node ran healthy before, for a set-back
opts = append(opts, jetstream.IncludeHistory())
}
if err := watch(name, opts...); err != nil {
@@ -418,15 +522,54 @@ func follow(ctx context.Context, js jetstream.JetStream, nc process.Subscriber,
hub := process.NewEventHub(logger.Printf)
// The seat list (seatlist.go), read over the connection and heard on the hub, given to catalogue at every change, and a
// pass made then: registered before the hub starts.
gate := &seatGate{}
if bus != nil {
gate.follow(seatlist.ProcessBus(bus.Call, hub), wake, logger.Printf)
gate.Follow(seatlist.ProcessBus(bus.Call, hub), wake, logger.Printf)
}
// The build seat's step-ended of an ask deletes the input kept for it (design 47 G §354) and ends the composition run that waits
// for it (A-240). The machines a composition step does not compose are the watchman's machine-away, heard once, in the world (§64, §389).
// The composition runs (design 47 G §718, §719), watched in their own state; a build seat's step-ended of a run's ask ends
// the run in its key.
var runs *compositionRuns
if kv := kvs[buckets.CompositionRuns()]; kv != nil {
set, err := runSettingsOf(getenv)
if err != nil {
return err
}
runs = newCompositionRuns(busRuns{ctx, js, kv}, set, time.Now, logger.Printf)
if js != nil {
runs.say = wantsPublisher(ctx, js, thisNode)
}
if bus != nil {
runs.drop = dropOver(bus.CallKept)
}
// The build seats' ask-taken and step-progress begin a run's clock (§720, A-466q).
if err := hearRunBounds(hub, runs, logger.Printf); err != nil {
logger.Printf("the build seats' ask-taken and step-progress are not heard, so a composition run is ended by no bound: %v", err)
}
}
if inputs != nil {
var runEnded func(buildstep.StepEnded) error
if runs != nil && bus != nil {
read := func(e buildstep.StepEnded) ([]byte, error) { return e.ReadOutput(buildstep.AskGo, bus.CallFile) }
runEnded = func(e buildstep.StepEnded) error { return runs.heardEnd(e, read) }
}
if err := hub.Handle(nodebuildgo.SubjectStepEndedAll, func(m jetstream.Msg) { heardStepEnded(inputs, runEnded, m, logger.Printf) }); err != nil {
return err
}
}
// The indexer's manifests, modules and module graph, through its first views and views family, never its buckets
// (DLV-F2r, ADR 0631): the first pass waits for the three answers, as it waits for every watch to hand what stands.
if iv != nil {
iv.hub = hub
started += iv.start(ctx, w, wake, settled)
// The teller's answers' picture is watched as a bucket is, but never gates the first pass: a teller that does not
// answer its first view only leaves the asks unanswered, said by the reader's finding (A-175).
if iv.answers != nil {
kvs[buckets.Answers] = iv.answers
if err := watch(buckets.Answers); err != nil {
logger.Printf("%v: no ask is answered until the assigner starts again", err)
}
}
}
// The seat's states arrive with the same delivery as this assigner (ADR 0567 §1): one not on the bus at this start is
// bound once the bus says it was created, and watched from then on, with no restart (issue 1790's kind). Until then no
@@ -435,15 +578,15 @@ func follow(ctx context.Context, js jetstream.JetStream, nc process.Subscriber,
name string
kv jetstream.KeyValue
}
assignmentsAppeared := make(chan appeared, len(seatBuckets)+2)
for _, name := range seatBuckets {
assignmentsAppeared := make(chan appeared, len(seatBuckets())+2)
for _, name := range seatBuckets() {
if kvs[name] == nil && js != nil {
process.AwaitBucket(ctx, js, nc, name, "the seat mesh-module-assigner waits for it",
logger.Printf).Ready(func(kv jetstream.KeyValue) { assignmentsAppeared <- appeared{name, kv} })
}
}
// And the two that choose where grants are read from, with the same delivery as the grants part that writes one.
for _, name := range []string{buckets.Grants, assign.PoliciesBucket, buckets.Provisions, plc.SeatHoldersBucket} {
for _, name := range []string{buckets.Grants, assign.PoliciesBucket(), buckets.Provisions, plc.SeatHoldersBucket()} {
if kvs[name] == nil && js != nil {
name := name
process.AwaitBucket(ctx, js, nc, name, "until then the bucket is not read",
@@ -472,16 +615,133 @@ func follow(ctx context.Context, js jetstream.JetStream, nc process.Subscriber,
}
}
p := &passer{kvs: kvs, w: w, logf: logger.Printf, say: say, findings: findings, said: map[string]bool{}, answeredAt: map[string]uint64{},
reads: reads, seats: gate}
reads: reads, seats: gate, askForFile: getenv("MESH_ASSIGNER_ASK_OPERATOR_FOR_FILE")}
p.askOperatorFor() // the setting ask-operator-for said once at the start (design 47 G A-425a)
// The wait on an outside cause (outside.go, design 47 G §706): the keeper's three events say when to judge again, and the
// seat mesh-wants' wait-held and wait-ended are said; registered before the hub starts.
if bus != nil && kvs[buckets.Waits()] != nil {
bound, settle, err := outsideSettings(getenv)
if err != nil {
return err
}
p.outside = newOutsideActs(bus.CallKept, wake, logger.Printf, bound, settle)
for _, subject := range []string{mcseat.SubjectConditionRaised, mcseat.SubjectConditionChanged, mcseat.SubjectConditionCleared} {
subject := subject
if err := hub.Handle(subject, func(m jetstream.Msg) {
p.outside.Heard(m.Subject(), m.Data())
if err := m.Ack(); err != nil {
logger.Printf("acknowledging %s: %v", m.Subject(), err)
}
}); err != nil {
logger.Printf("%s is not heard, so a wait on an outside cause is judged again only when its check changes: %v", subject, err)
}
}
p.outside.readStart()
}
if js != nil {
p.publishWants = wantsPublisher(ctx, js, thisNode)
if iv != nil && iv.h != nil {
objects := newBusObjects(js, process.Account{Node: thisNode, Module: assignment.Module()}, assigngraph.RevisionsObjects)
p.graph = &graphKeeper{objects: objects, halves: iv.h.views}
keep := func(ctx context.Context, ev meshcatalog.CatalogRevisionEvent) error {
return p.keepCandidate(ctx, iv.call, ev)
}
iv.candidates.Store(&keep)
// A held revert's running entry and its want's, asked of the seat mesh-catalog's verb entry (design 47 G §710, A-217).
p.entries = meshcatalogclient.NewEntries(iv.h.call)
p.entries.Changed = func(meshcatalogclient.EntryRow) { wake() }
// The pins of the revisions (pins.go, design 47 G §579): the gate's pinned, freed, heads-replaced and pins-stated
// on the hub, registered before it starts.
if kv := kvs[pinsBucket()]; kv != nil {
k := &pinKeeper{ctx: ctx, st: kvEnds{ctx, kv}, objects: objects, inUse: inUseOf(w), findings: findings, now: time.Now, logf: logger.Printf}
if err := k.made(); err != nil {
logger.Printf("the state %s is not marked made, so no revision is removed until it is: %v", pinsState, err)
}
if err := hearPins(hub, k); err != nil {
logger.Printf("a pin is not heard, so no revision is removed until the assigner starts again: %v", err)
} else {
p.graph.pins = k
k.watchUnpins(kv)
}
}
}
}
// The node-engine seat's manifest-reads-changed, for one node (ADR 0618 §4): that node is asked again, with no timer.
// Heard on the assigner's durable consumer on EVENTS, which the grants part makes from the manifest's consumes; where it
// is not there yet, a node is asked again only when it comes back online.
if js != nil {
hearReadsChanged(ctx, js, hub, reads, findings, gate.eventsLive, logger.Printf)
// The teller's ask-ended (issue 1966): an ask ended at the channel without an answer is written again; registered
// before hearReadsChanged starts the hub.
if err := hearAskEnded(ctx, js, hub, kvs[buckets.Asks()], staleOfWorld(w), logger.Printf); err != nil {
logger.Printf("%s is not heard, so an ask that ends at the operator channel without an answer is not asked again until the assigner starts again: %v", askEndedSubject, err)
}
readEndedAtBind(ctx, js, hub, kvs[buckets.Asks()], staleOfWorld(w), bus, callWait{heard: func() bool { return w.seatHeard(oc.Seat) }, findings: findings}, logger.Printf)
if kv := kvs[writtenBucket()]; kv != nil {
// The runner's pipeline-ended and group-ended (design 47 G §29): kept in the state written, which the wants follow
// once the first registrations are written (§95, §353).
p.ends = newPipelineEnds(kvEnds{ctx, kv}, wake, logger.Printf)
p.ends.trunk = w.trunkName
p.ends.runEnded = func(group string) error { return p.dropCandidate(ctx, group) }
err := hearEnds(hub, p.ends)
if err == nil && bus != nil {
err = followRegistrations(ctx, hub, bus.Call, p.ends)
}
if err != nil {
logger.Printf("a pipeline's end or a registration is not heard, so the wants keep the trunk-only form until the assigner starts again: %v", err)
}
}
hearDelivery(ctx, js, w, wake, findings, logger.Printf) // version-released, version-delivered, machine-away and machine-back
hearBuilds(ctx, js, &w.ends, wake, findings, logger.Printf)
if err := hearTaken(hub, &w.taken, wake, logger.Printf); err != nil {
logger.Printf("the indexer's take-ins are not heard, so an entry held by an order edge waits until the assigner starts again: %v", err)
}
hearReadsChanged(ctx, js, hub, reads, findings, gate.EventsLive, logger.Printf)
hearRunning(ctx, js, w, wake, findings, logger.Printf)
}
if bus != nil && kvs[buckets.Puts] != nil {
if bus != nil && kvs[buckets.Puts()] != nil {
p.acts = newPutActs(bus, wake, logger.Printf)
}
// The composition step (design 47 G §22, §354): the seat mesh-wants' accepted kind step, run by one run ask per machine.
if bus != nil && js != nil && inputs != nil && p.publishWants != nil && runs != nil {
run := &compositionRun{runs: runs, inputs: &compositionInputs{machines: w.machinesOf, callFile: bus.CallFile}, keeper: inputs, reads: &compositionReads{}, call: bus.CallKept,
trunk: trunkOf(iv, w.trunkName), running: w.runningOf, away: func(machine string) bool { return w.awayNow()[machine] }, put: runAskPublisher(js), ask: bus.CallFile, now: time.Now, logf: logger.Printf}
steps := &compositionSteps{node: thisNode, say: p.publishWants, run: run.run, resume: run.resume, ended: runs.stepEnded, now: time.Now, logf: logger.Printf,
asker: stepAskerOf(seatlist.Definition(gate.Reader, meshwants.Seat))}
move := steps.move(ctx) // the readers a rerun carried (§727, A-470d)
runs.moved.Store(&move)
// The state's watch wakes the steps waiting on a run and hears a bound's expiry; the runs standing at the start are taken up
// once the values that stand are read (§719, §720).
if err := watchRuns(ctx, kvs[buckets.CompositionRuns()], runs, runs.expired, func() { steps.takeUp(ctx, runs) }); err != nil {
return fmt.Errorf("the state %s is not watched: %w", buckets.CompositionRunsState, err)
}
// The runs' read and drop, the seat mesh-wants' verbs compositions and compositions-drop (§728, A-469f), answered here
// where the runs are kept and the readers' ends said; the drop's hand act recorded through the seat mesh-hand-acts first.
if e, ok := bus.(emitting); ok {
record := func(q meshhandactsclient.Request) error {
_, err := meshhandactsclient.Recorder{Ask: bus.Call}.Record(q)
return err
}
stopVerbs, err := e.AnswerSeat(meshwants.Seat, seatlist.Definition(gate.Reader, meshwants.Seat), compositionVerbs(runs, steps, record))
if err != nil {
logger.Printf("the verbs %s and %s are not answered until the assigner starts again: %v", meshwants.VerbCompositions, meshwants.VerbCompositionsDrop, err)
} else {
go func() { <-ctx.Done(); stopVerbs() }()
}
}
// A superseded or cancelled pipeline's composition step leaves the runs it reads (§723, A-469n).
if p.ends != nil {
left := func(pipeline string) error {
_, err := runs.leave(pipeline, steps.leave)
return err
}
p.ends.left.Store(&left)
}
if err := serveCompositionSteps(ctx, nc, steps); err != nil {
logger.Printf("the composition step is not heard, so no composition step runs until the assigner starts again: %v", err)
} else {
logger.Printf("the composition step is heard on %s", meshwants.AcceptSubjectStep)
}
}
if bus != nil {
p.seat = newSeatActs(bus, wake, logger.Printf)
}
@@ -506,7 +766,7 @@ func follow(ctx context.Context, js jetstream.JetStream, nc process.Subscriber,
// be said before this credential may hear it: every pass, itself started by a watched change, binds each one the
// bus now holds, and says the seat waits while one is missing.
var unbound []string
for _, name := range seatBuckets {
for _, name := range seatBuckets() {
if kvs[name] != nil || js == nil {
continue
}
@@ -531,7 +791,7 @@ var PutsReopenEvery = time.Minute
// (ADR 0437 clause 9).
func sayVia(ctx context.Context, js jetstream.JetStream) func(oc.Condition) error {
return func(c oc.Condition) error {
subject, err := occ.ConditionSubject(assignment.Module)
subject, err := occ.ConditionSubject(assignment.Module())
if err != nil {
return err
}
@@ -544,13 +804,10 @@ func sayVia(ctx context.Context, js jetstream.JetStream) func(oc.Condition) erro
}
}
// hearReadsChanged hears the node-engine seat's event manifest-reads-changed on the assigner's one hub of its durable
// consumer on EVENTS, and asks the node it names again; the hub also hands the indexer's views to the followers of
// indexerViews, and starts once both are registered.
func hearReadsChanged(ctx context.Context, js jetstream.JetStream, hub *process.EventHub, reads *enginereads.Keeper, findings assign.Findings, live func(), logf func(string, ...any)) {
account := process.Account{Node: thisNode, Module: assignment.Module}
w := notHeardWriter(findings, logf)
handle := func(m jetstream.Msg) {
// readsChangedHandler is what the assigner does with each event manifest-reads-changed: acknowledges it, keeps what it says
// of the node (a statement older than it does not stand) and asks the node again.
func readsChangedHandler(reads *enginereads.Keeper, logf func(string, ...any)) func(jetstream.Msg) {
return func(m jetstream.Msg) {
if err := m.Ack(); err != nil {
logf("acknowledging %s: %v", m.Subject(), err)
}
@@ -561,10 +818,26 @@ func hearReadsChanged(ctx context.Context, js jetstream.JetStream, hub *process.
logf("%s holds what is not %s, and %s is asked again all the same: %v", m.Subject(), enginereads.Event, node, err)
reads.AskNode(node, enginereads.Event+" that does not read")
default:
// What the event says is kept first: a statement older than it does not stand while the node is asked again.
if e, derr := enginereads.DecodeChanged(m.Data()); derr == nil {
reads.HeardChanged(e)
}
reads.AskNode(node, enginereads.Event)
}
}
}
// hearReadsChanged hears the node-engine seat's event manifest-reads-changed on the assigner's one hub of its durable
// consumer on EVENTS, and asks the node it names again; the hub also hands the indexer's views to the followers of
// indexerViews, and starts once both are registered.
func hearReadsChanged(ctx context.Context, js jetstream.JetStream, hub *process.EventHub, reads *enginereads.Keeper, findings assign.Findings, live func(), logf func(string, ...any)) {
account := process.Account{Node: thisNode, Module: assignment.Module()}
w := notHeardWriter(findings, logf)
handle := readsChangedHandler(reads, logf)
err := hub.Handle(enginereads.SubjectPrefix+"*", handle)
// At each bind every node the assigner holds a statement of is asked again: an event said before its consumer existed
// is not delivered to it (issue 1966 note 155: ace's bootstrapped statement stood; ADR 0668 §4).
hub.OnBound(reads.AtBind(func() []string { return slices.Sorted(maps.Keys(reads.Statements())) }))
if err == nil {
err = hub.Start(ctx, js, account)
}
@@ -573,8 +846,11 @@ func hearReadsChanged(ctx context.Context, js jetstream.JetStream, hub *process.
return
}
w.Heard(process.EventsStream)
// The build seats' step-ended is a kept seat event, on its own stream and never on EVENTS: bound here, or no composition
// run's end is heard and every composition step waits for ever (design 47 G §354, A-240; mesh-sdk EventHub.StartKept).
logf("the kept seat events heard: %d streams bound", hub.StartKept(ctx, js, account))
if live != nil {
live() // the seat list, unread while the seat was silent, is read now (seatGate.eventsLive)
live() // the seat list, unread while the seat was silent, is read now (seatlist.Part.EventsLive)
}
go func() {
<-ctx.Done()
@@ -1,6 +1,9 @@
package main
import (
"encoding/json"
mcseat "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions"
"git.novox.be/novox/mesh-sdk/go/views"
"mesh-delivery-assigner/internal/assign"
plc "mesh-delivery-assigner/internal/assignment"
"mesh-delivery-assigner/internal/buckets"
@@ -25,14 +28,14 @@ import (
oc "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/seats/operatorchannel"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-sdk/go/process"
"git.novox.be/novox/mesh-sdk/go/seatlist"
)
// 1297/B2a: the buckets the program opens are exactly the manifest's reads and states, as the broker names them
// (`<module>.<state>` read as the bucket `<module>_<state>`), so it is granted what it reads and reads nothing else.
func TestOpensWhatItsManifestNames(t *testing.T) {
// Review round 2: the assigner's views emitter writes its finding view-unsaid (Emitter.Findings set) when it keeps findings.
findings := assign.Findings{Put: func(string, []byte) error { return nil }, Delete: func(string) error { return nil }}
if viewsEmitter(nil, process.Account{}, nil, findings, nil, t.Logf).Findings == nil {
if viewsEmitter(nil, process.Account{}, nil, &heldWriter{}, t.Logf).Findings == nil {
t.Error("the assigner's views emitter writes no view-unsaid finding")
}
// 1297/B2a: without a credential the program does not start, and says why.
@@ -66,7 +69,7 @@ func TestOpensWhatItsManifestNames(t *testing.T) {
for _, pair := range []struct {
what string
code, want []string
}{{"reads", readBuckets, reads}, {"states", append(slices.Clone(ownBuckets), marksBucket, firstViewsBucket), states}} { // the marks are bound by the views family (views.go)
}{{"reads", readBuckets, reads}, {"states", append(slices.Clone(ownBuckets()), marksBucket(), firstViewsBucket()), states}} { // the marks are bound by the views family (views.go)
got, want := slices.Sorted(slices.Values(pair.code)), slices.Sorted(slices.Values(pair.want))
if !reflect.DeepEqual(got, want) {
t.Errorf("the program's %s are %v, the manifest's %v", pair.what, got, want)
@@ -76,7 +79,7 @@ func TestOpensWhatItsManifestNames(t *testing.T) {
for _, s := range keptStates {
kept = append(kept, m.Module+"_"+s.Name)
}
if got, want := slices.Sorted(slices.Values(kept)), slices.Sorted(slices.Values(append(slices.Clone(ownBuckets), marksBucket, firstViewsBucket))); !reflect.DeepEqual(got, want) {
if got, want := slices.Sorted(slices.Values(kept)), slices.Sorted(slices.Values(append(slices.Clone(ownBuckets()), marksBucket(), firstViewsBucket()))); !reflect.DeepEqual(got, want) {
t.Errorf("the program announces %v, keeps %v", got, want)
}
// ADR 0546: whatever keeps the puts' bucket from opening (not there, not granted, no answer in time), the assigner opens
@@ -87,17 +90,17 @@ func TestOpensWhatItsManifestNames(t *testing.T) {
starts bool
said string
}{
{buckets.Puts, jetstream.ErrBucketNotFound, true, "no put is taken further"},
{buckets.Puts, errors.New("nats: permissions violation for subscription to \"$JS.API.STREAM.INFO.KV_mesh-delivery-assigner_puts\""), true, "no put is taken further"},
{buckets.Puts, context.DeadlineExceeded, true, "no put is taken further"},
{buckets.Wants, errors.New("nats: permissions violation"), false, ""},
{buckets.Puts(), jetstream.ErrBucketNotFound, true, "no put is taken further"},
{buckets.Puts(), errors.New("nats: permissions violation for subscription to \"$JS.API.STREAM.INFO.KV_mesh-delivery-assigner_puts\""), true, "no put is taken further"},
{buckets.Puts(), context.DeadlineExceeded, true, "no put is taken further"},
{buckets.Wants(), errors.New("nats: permissions violation"), false, ""},
// Issue 774: the grants part's grants not there do not stop the start.
{buckets.Grants, jetstream.ErrBucketNotFound, true, "no grant is read"},
} {
var logged string
kvs, err := open(context.Background(), refusingJS{missing: c.missing, err: c.err}, func(f string, a ...any) { logged += fmt.Sprintf(f, a...) })
switch {
case c.starts && (err != nil || kvs[c.missing] != nil || len(kvs) != len(readBuckets)+len(ownBuckets)-1 || !strings.Contains(logged, c.said)):
case c.starts && (err != nil || kvs[c.missing] != nil || len(kvs) != len(readBuckets)+len(ownBuckets())-1 || !strings.Contains(logged, c.said)):
t.Errorf("%s refused with %v: the start answered %v, %d buckets, logged %q", c.missing, c.err, err, len(kvs), logged)
case !c.starts && (err == nil || !strings.Contains(err.Error(), "grant of "+c.missing)): // 1945: named with its grant
t.Errorf("%s refused with %v: the start answered %v", c.missing, c.err, err)
@@ -109,7 +112,7 @@ func TestOpensWhatItsManifestNames(t *testing.T) {
defer cancel()
wrote := make(chan string, 8)
kvs := kvSet{}
for _, name := range append(append([]string{}, readBuckets...), ownBuckets...) {
for _, name := range append(append([]string{}, readBuckets...), ownBuckets()...) {
kvs[name] = &watchKV{memKV: &memKV{values: map[string][]byte{}}}
}
placed, err := mmac.AssignmentsValues(mma.Assignments{Node: "ace"})
@@ -117,12 +120,12 @@ func TestOpensWhatItsManifestNames(t *testing.T) {
t.Fatal(err)
}
for key, raw := range placed {
kv := kvs[plc.AssignmentsBucket].(*watchKV)
kv := kvs[plc.AssignmentsBucket()].(*watchKV)
kv.entries = append(kv.entries, kvEntry{key: key, value: raw})
}
kvs[buckets.Puts].(*watchKV).closed = true
kvs[buckets.Wants].(*watchKV).wrote = wrote
go follow(ctx, nil, nil, kvs, func(oc.Condition) error { return nil }, assign.Findings{}, nil, nil, log.New(io.Discard, "", 0))
kvs[buckets.Puts()].(*watchKV).closed = true
kvs[buckets.Wants()].(*watchKV).wrote = wrote
go follow(ctx, nil, nil, kvs, func(oc.Condition) error { return nil }, assign.Findings{}, nil, nil, nil, seatlist.NewPart("assigner", seatListAgainCallers), log.New(io.Discard, "", 0), func(string) string { return "" })
select {
case key := <-wrote:
if key != "want.ace.node" {
@@ -197,3 +200,12 @@ func (e kvEntry) Created() time.Time { return time.Time{} }
func (w *watchKV) Keys(context.Context, ...jetstream.WatchOpt) ([]string, error) {
return nil, jetstream.ErrNoKeysFound
}
// putInto is an assign.Findings Put that keeps each finding in into, as the finding writer would, by its key and its words.
func putInto(into map[string][]byte) func(mcseat.Finding) error {
return func(f mcseat.Finding) error {
raw, err := json.Marshal(f)
into[views.FindingKey(f.Scope, f.ID, f.Kind)] = raw
return err
}
}
@@ -18,10 +18,9 @@ import (
// The state this seat's assignments were kept in before ADR 0641 gave it its name. The assigner reads it here and nowhere
// else: at its start it copies each key into `assignments` (copyRetired) and keeps no reader of it afterwards. The
// manifest still declares the state, so the assigner's account may read it for the copy; a later release drops it.
const (
retiredState = "placement"
retiredBucket = plc.Module + "_" + retiredState
)
const retiredState = "placement"
func retiredBucket() string { return plc.Module() + "_" + retiredState }
// CopiedEvent is the module's event saying the copy was made, once: mesh.mod.mesh-delivery-assigner.event.assignments-copied.
const CopiedEvent = "assignments-copied"
@@ -37,10 +36,9 @@ type copiedSaid struct {
// copiesState is the assigner's own state of its copies, read by its tool assigner_read_copies, and copiesBucket its bucket.
// The retired state gets nothing written: readers of other modules still parse every key in it.
const (
copiesState = "copies"
copiesBucket = plc.Module + "_" + copiesState
)
const copiesState = "copies"
func copiesBucket() string { return plc.Module() + "_" + copiesState }
// copiedMarker is the key, in the state copies, that says the copy ended: its time and the keys it copied. It is written
// after the last key, and the copy is made at every start until it is there and never after, so a copy cut short by a
@@ -63,12 +61,12 @@ func (p *passer) copyRetired(ctx context.Context) bool {
if p.copied {
return true
}
old, next, copies := p.kvs[retiredBucket], p.kvs[plc.AssignmentsBucket], p.kvs[copiesBucket]
old, next, copies := p.kvs[retiredBucket()], p.kvs[plc.AssignmentsBucket()], p.kvs[copiesBucket()]
if next == nil || copies == nil {
return false
}
if old == nil {
p.logf("assignments: the retired state %s cannot be read, so nothing is copied from it", retiredBucket)
p.logf("assignments: the retired state %s cannot be read, so nothing is copied from it", retiredBucket())
p.copied = true
return true
}
@@ -77,12 +75,12 @@ func (p *passer) copyRetired(ctx context.Context) bool {
p.copied = true // the copy ended at an earlier start: nothing is copied again
return true
case !errors.Is(err, jetstream.ErrKeyNotFound):
p.logf("assignments: the marker %s of %s cannot be read, and the copy is tried again at the next pass: %v", copiedMarker, copiesBucket, err)
p.logf("assignments: the marker %s of %s cannot be read, and the copy is tried again at the next pass: %v", copiedMarker, copiesBucket(), err)
return false
}
names, err := old.Keys(ctx)
if err != nil && !errors.Is(err, jetstream.ErrNoKeysFound) {
p.logf("assignments: the keys of %s cannot be listed, and are tried again at the next pass: %v", retiredBucket, err)
p.logf("assignments: the keys of %s cannot be listed, and are tried again at the next pass: %v", retiredBucket(), err)
return false
}
// A node's module keys before its node key: the node key is the commit the readers wait for.
@@ -120,13 +118,13 @@ func (p *passer) copyRetired(ctx context.Context) bool {
return false
default:
said.Copied++
p.w.putEntry(plc.AssignmentsBucket, key, entry.Value(), rev, p.clock())
p.w.putEntry(plc.AssignmentsBucket(), key, entry.Value(), rev, p.clock())
}
}
}
mark, _ := json.Marshal(copiedMark{At: p.clock(), Copied: said.Copied + said.Present})
if _, err := copies.Put(ctx, copiedMarker, mark); err != nil {
p.logf("assignments: the end of the copy is not written as %s in %s, and the copy is tried again at the next pass: %v", copiedMarker, copiesBucket, err)
p.logf("assignments: the end of the copy is not written as %s in %s, and the copy is tried again at the next pass: %v", copiedMarker, copiesBucket(), err)
return false
}
p.copied = true
@@ -134,7 +132,7 @@ func (p *passer) copyRetired(ctx context.Context) bool {
return true // the retired state holds nothing
}
p.logf("assignments: copied %d keys of %s into %s (%d already there kept as they are, %d of the form placement.<node> not copied, %d fitting no form left)",
said.Copied, retiredBucket, plc.AssignmentsBucket, said.Present, said.Dropped, said.Skipped)
said.Copied, retiredBucket(), plc.AssignmentsBucket(), said.Present, said.Dropped, said.Skipped)
if p.seat != nil {
if err := p.seat.bus.Emit(CopiedEvent, said); err != nil {
p.logf("assignments: the copy is not said as an event: %v", err)
@@ -0,0 +1,26 @@
package main
import (
"testing"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
)
// The module claiming the seat node-engine is found by its served verbs, in the catalog's form `seat:<seat>.<verb>`
// and in the bare form (live, 2026-11-16: every composition step said "holds no module claiming the seat node-engine").
func TestTheNodeEngineEntryIsFoundByItsServedVerbs(t *testing.T) {
for _, c := range []struct {
name string
serves []string
found bool
}{
{"the catalog's seat form", []string{"seat:node-engine.compose", "seat:node-engine.acts"}, true},
{"the bare form", []string{"node-engine.compose"}, true},
{"another seat", []string{"seat:node-engine-x.compose", "seat:mesh-wants.ask"}, false},
} {
e, ok := nodeEngineEntry(map[string]meshcatalog.CatalogEntry{"other": {Serves: []string{"seat:mesh-builds.ask"}}, "engine": {Serves: c.serves}})
if ok != c.found || (ok && e.Serves[0] != c.serves[0]) {
t.Errorf("%s: found %v (%v), want %v", c.name, ok, e.Serves, c.found)
}
}
}
@@ -0,0 +1,118 @@
package main
import (
"bytes"
"context"
"errors"
"fmt"
"sync"
"github.com/nats-io/nats.go/jetstream"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-sdk/go/process"
"mesh-delivery-assigner/internal/assigngraph"
)
// busObjects is the assigner's own object bucket assignment-revisions in the old `objects` section (novox/hq ADR 0619 §2),
// which the grants part creates, as the passer's process reaches it: opened at its first use and kept; until the bucket exists
// every call is an error saying so, and the next call opens it again (design 47 G A-67, modelled on the indexer's busObjects).
type busObjects struct {
js jetstream.JetStream
module string
local string
mu sync.Mutex
o jetstream.ObjectStore
}
// newBusObjects is the object bucket of this local name of the module the account runs as.
func newBusObjects(js jetstream.JetStream, cred process.Account, local string) *busObjects {
return &busObjects{js: js, module: cred.Module, local: local}
}
func (b *busObjects) open(ctx context.Context) (jetstream.ObjectStore, error) {
b.mu.Lock()
defer b.mu.Unlock()
if b.o != nil {
return b.o, nil
}
o, err := b.js.ObjectStore(ctx, catalogue.ObjectsBucket(b.module, b.local))
if errors.Is(err, jetstream.ErrBucketNotFound) || errors.Is(err, jetstream.ErrStreamNotFound) {
return nil, fmt.Errorf("the object bucket %s is not on the bus yet (the grants part creates it from the manifest's objects): %w", b.local, process.ErrNotYet)
}
if err != nil {
return nil, fmt.Errorf("the object bucket %s is not open: %w", b.local, err)
}
b.o = o
return o, nil
}
func (b *busObjects) Put(ctx context.Context, name string, data []byte) error {
o, err := b.open(ctx)
if err != nil {
return err
}
_, err = o.Put(ctx, jetstream.ObjectMeta{Name: name}, bytes.NewReader(data))
return err
}
func (b *busObjects) Get(ctx context.Context, name string) ([]byte, error) {
o, err := b.open(ctx)
if err != nil {
return nil, err
}
data, err := o.GetBytes(ctx, name)
if errors.Is(err, jetstream.ErrObjectNotFound) {
return nil, assigngraph.ErrNoObject
}
return data, err
}
func (b *busObjects) Names(ctx context.Context) ([]string, error) {
o, err := b.open(ctx)
if err != nil {
return nil, err
}
infos, err := o.List(ctx)
if errors.Is(err, jetstream.ErrNoObjectsFound) {
return []string{}, nil
}
if err != nil {
return nil, err
}
names := make([]string, 0, len(infos))
for _, i := range infos {
names = append(names, i.Name)
}
return names, nil
}
// Delete removes the object of that name; one not held is no error (design 47 G §579: a revision nothing pins is removed).
func (b *busObjects) Delete(ctx context.Context, name string) error {
o, err := b.open(ctx)
if err != nil {
return err
}
if err := o.Delete(ctx, name); err != nil && !errors.Is(err, jetstream.ErrObjectNotFound) {
return err
}
return nil
}
// Fill is the bytes the bucket holds and its cap (assigngraph.Filler).
func (b *busObjects) Fill(ctx context.Context) (int64, int64, error) {
o, err := b.open(ctx)
if err != nil {
return 0, 0, err
}
st, err := o.Status(ctx)
if err != nil {
return 0, 0, err
}
info, err := b.js.Stream(ctx, "OBJ_"+st.Bucket())
if err != nil {
return int64(st.Size()), 0, err
}
return int64(st.Size()), info.CachedInfo().Config.MaxBytes, nil
}
@@ -0,0 +1,296 @@
package main
import (
"context"
"encoding/json"
"fmt"
"strconv"
"sync"
"git.novox.be/novox/mesh-contracts/go/seats/meshbroker"
mma "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
"git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
mwc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshwantsclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshdelivery"
seat "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-sdk/go/process"
"git.novox.be/novox/mesh-sdk/go/seatdef"
"mesh-delivery-assigner/internal/acting"
"mesh-delivery-assigner/internal/assign"
"mesh-delivery-assigner/internal/assigngraph"
"mesh-delivery-assigner/internal/assignment"
"mesh-delivery-assigner/internal/buckets"
)
// The three order edges of a delivery that crosses a form change (design 47 G §298, A-245, A-258, A-259, A-260). Each is an acting wait of the
// assigner, kept in the state `waits` under `order.<node>.<module>.<part>` beside the acting waits, in the step placing, said as wait-held
// when a want is held for it and wait-ended (ran, released, replaced) when it moves; assigner_waits reads them and assigner_release with
// how `now` releases them, as it does an acting wait. The holders of the seats are read from the seat holders the assignments compose
// (assignment.SeatHoldersOf), never named:
// - the node-backup holder's and the bus module's (the holder of the seat mesh-broker) new versions run before a module whose kept data's
// form changes is moved, since the restore point needs both (OrderBackup);
// - at a revert a node's node-engine goes back last on that node, after every module it restores there runs the reverted build, which it
// starts only once it has said `restored` (OrderEngineLast);
// - the reverted assigner and gate are wanted only once the indexer's take-in.taken of the trunk branch names a source revision at least
// the trunk's head, the highest `src` of the trunk branch's module values (OrderTakenIn, A-260).
// takenSubject is the indexer's event take-in.taken on its own stream, as the manifest's consumes names it.
var takenSubject = process.ModuleStreamSubject(buckets.IndexerModule, "take-in.taken")
// takenSources are the newest source revisions a take-in.taken named, by watched branch, as heard (hearBuildsAndReleases).
type takenSources struct {
mu sync.Mutex
own map[string]int64
}
// put takes one take-in.taken in. A hand drop, and a taken with no source revision (one said before G), take nothing in.
func (t *takenSources) put(data []byte) error {
var e meshcatalog.TakeInTaken
if err := json.Unmarshal(data, &e); err != nil {
return fmt.Errorf("a take-in.taken that is none: %w", err)
}
if e.Dropped || e.Source == 0 || e.Branch == "" {
return nil
}
t.mu.Lock()
defer t.mu.Unlock()
if t.own == nil {
t.own = map[string]int64{}
}
t.own[e.Branch] = max(t.own[e.Branch], e.Source)
return nil
}
// of is the newest source revision of branch taken in; 0 before one is heard.
func (t *takenSources) of(branch string) int64 {
t.mu.Lock()
defer t.mu.Unlock()
return t.own[branch]
}
// orderEdge is one order edge held on module's want on node: part's version fp must run on partNode (OrderBackup, OrderEngineLast), or the
// trunk's source revision source be taken in (OrderTakenIn).
type orderEdge struct {
node, module, part, partNode, fp, entry, order string
source int64
}
func (e orderEdge) key() string { return acting.OrderKey(e.node, e.module, e.part) }
func (e orderEdge) acting() assign.ActingEdge {
return assign.ActingEdge{Node: e.partNode, Part: e.part, Fp: e.fp, Step: seatdef.StepPlace}
}
// orderRuns says an order edge is met: its part runs the version, or the source revision is taken in.
func (p *passer) orderRuns(n assign.Nodes, e orderEdge) bool {
if e.order == acting.OrderTakenIn {
return p.w.taken.of(p.w.trunkName()) >= e.source
}
return n.Runs(e.acting())
}
// seatHolders are the holders of each seat as the assignments compose them, by seat name.
func (p *passer) holdersBySeat() map[string][]mma.SeatHoldersHoldersItem {
out := map[string][]mma.SeatHoldersHoldersItem{}
for _, sh := range assignment.SeatHoldersOf(p.w.assignments()) {
out[sh.Seat] = append(out[sh.Seat], sh.Holders...)
}
return out
}
// orderEdgesOf computes §298's edges on the wants of module m on each of its nodes, into p.orders. wanted is m's wants by node; trunk the
// trunk's module values. A node that has no running build heard, runs m at its trunk version already, or is wanted that version already
// has none: nothing moves. It answers, by node, whether an edge still stands that cannot be recorded as a wait because the catalog entry
// it reads is not answered yet (asked, and its answer wakes a pass): the want is held meanwhile, never written across a form change unread.
func (p *passer) orderEdgesOf(ctx context.Context, m assign.Module, wanted map[string]mwc.Want, trunk map[string]meshcatalog.ModulesByModuleValue) map[string]bool {
unread := map[string]bool{}
p.orderVisited[m.Name] = true
if m.FP == "" || p.graph == nil || p.entries == nil {
return unread
}
var holders map[string][]mma.SeatHoldersHoldersItem
for _, node := range m.Nodes {
if w, ok := wanted[node]; ok && !w.Removed && w.Fp == m.FP {
continue // the version is wanted already: nothing moves, so nothing waits
}
run, heard := p.w.runningOf(node, m.Name)
if !heard || run.Stopped || run.Fingerprint == "" || run.Fingerprint == m.FP {
continue
}
if holders == nil {
holders = p.holdersBySeat()
}
held := func(seatName string) bool {
for _, h := range holders[seatName] {
if h.Module == m.Name && h.Node == node {
return true
}
}
return false
}
add := func(e orderEdge) {
e.node, e.module, e.entry = node, m.Name, m.FP
p.orders[e.key()] = e
}
// 1. a kept data's form changes: the restore point needs the new node-backup holder and bus module.
changes, known := p.formChange(ctx, m.Name, run.Fingerprint, m.FP)
if !known {
unread[node] = true
}
if len(changes) > 0 {
for seatName, onNode := range map[string]bool{catalogue.BackupSeat: true, meshbroker.Seat: false} {
for _, h := range holders[seatName] {
if h.Module == m.Name || (onNode && h.Node != node) || trunk[h.Module].Fp2 == "" {
continue
}
add(orderEdge{part: h.Module, partNode: h.Node, fp: trunk[h.Module].Fp2, order: acting.OrderBackup})
}
}
}
if !held(nodeengine.Seat) && !held(mma.Seat) && !held(meshdelivery.Seat) {
continue
}
reverted, err := assigngraph.Reverted(ctx, p.graph.objects, node, m.Name, run.Fingerprint, m.FP)
if err != nil {
p.logf("whether the want of %s on %s at %s is a revert is not read: %v", m.Name, node, m.FP, err)
continue
}
if !reverted {
continue
}
// 2. at a revert the node-engine goes back last on its node: after every module that is set back there across a form change runs.
if held(nodeengine.Seat) {
for module, byNode := range p.w.wantsOf() {
// What it is set back to is its trunk version, which the rules write as its want in this pass.
target := trunk[module].Fp2
if w, ok := byNode[node]; module == m.Name || !ok || w.Removed || target == "" {
continue
}
xrun, heard := p.w.runningOf(node, module)
if !heard || xrun.Stopped || xrun.Fingerprint == "" || xrun.Fingerprint == target {
continue
}
if back, err := assigngraph.Reverted(ctx, p.graph.objects, node, module, xrun.Fingerprint, target); err != nil || !back {
continue
}
xchanges, known := p.formChange(ctx, module, xrun.Fingerprint, target)
if !known {
unread[node] = true
}
if len(xchanges) > 0 {
add(orderEdge{part: module, partNode: node, fp: target, order: acting.OrderEngineLast})
}
}
}
// 3. the reverted assigner and gate wait for the indexer to take in the trunk's head.
if held(mma.Seat) || held(meshdelivery.Seat) {
var head int64
for _, v := range p.w.trunkOf(p.w.trunkName()) {
head = max(head, v.Src)
}
if head > 0 {
add(orderEdge{part: buckets.IndexerModule, fp: strconv.FormatInt(head, 10), source: head, order: acting.OrderTakenIn})
}
}
}
return unread
}
// orderActing is the order edges of module on node that still hold its want, as acting edges: those not met, and not released by hand. A
// node whose catalog entry is not read yet holds its want too, on a stand-in edge no part runs.
func (p *passer) orderActing(module string, released map[string]bool, unread map[string]bool, n func() assign.Nodes) func(node string) []assign.ActingEdge {
return func(node string) []assign.ActingEdge {
var out []assign.ActingEdge
nodes := n()
for _, e := range p.orders {
if e.module == module && e.node == node && !released[e.key()+"@"+e.fp] && !p.orderRuns(nodes, e) {
out = append(out, assign.ActingEdge{Node: e.partNode, Part: e.part, Fp: e.fp, Step: seatdef.StepPlace})
}
}
if unread[node] {
out = append(out, assign.ActingEdge{Node: node, Part: "the catalog entry", Step: seatdef.StepPlace})
}
return out
}
}
// orderWaits keeps the order waits after the pass's wants, as actingWaits keeps the acting waits: it starts the wait of each edge not met,
// ends the wait of one that ran, was replaced or was released, and says each.
func (p *passer) orderWaits(ctx context.Context, n assign.Nodes, wanted map[string]map[string]mwc.Want) {
if p.kvs[buckets.Waits()] == nil {
return
}
now := p.clock()
kept := p.w.read(buckets.Waits())
trunk := p.w.trunk()
if p.orderSaid == nil {
p.orderSaid = map[string]bool{}
}
standing := map[string]bool{}
for key, e := range p.orders {
if w, ok := wanted[e.module][e.node]; ok && !w.Removed && w.Fp == e.entry {
continue
}
if p.orderRuns(n, e) {
continue
}
standing[key] = true
if raw := kept[key]; raw != nil {
if w, err := acting.Decode(raw); err == nil && w.Entry == e.entry && w.Fp == e.fp {
if !w.Released && !p.orderSaid[key] {
// A wait still held after a restart is said again, as wait-held (A-260).
if err := p.wantsSay(seat.EventWaitHeld, acting.Body(w, assignment.Module()), key+"."+e.fp+"."+e.entry+".again"); err != nil {
p.logf("the wait of %s on %s for %s is not said again, and is said at the next pass: %v", e.module, e.node, e.part, err)
} else {
p.orderSaid[key] = true
}
}
p.actingReleaseSaid(ctx, key, w)
continue
}
}
if !n.Online[e.node] {
continue // a node away holds only itself, and its clock has not started (§268)
}
w := acting.Wait{Step: seatdef.StepPlace, Node: e.node, Module: e.module, Part: e.part, PartNode: e.partNode, Fp: e.fp, Entry: e.entry, Order: e.order,
Since: now, ClockFrom: now, Bound: acting.BoundOf(seat.Edge{Step: seatdef.StepPlace}).String()}
if err := p.wantsSay(seat.EventWaitHeld, acting.Body(w, assignment.Module()), key+"."+e.fp+"."+e.entry); err != nil {
p.logf("the wait of %s on %s for %s is not said, and is said at the next pass: %v", e.module, e.node, e.part, err)
continue
}
p.put(ctx, buckets.Waits(), key, func() ([]byte, error) { return acting.Encode(w) })
p.orderSaid[key] = true
}
for key, raw := range kept {
if !acting.IsOrder(key) || standing[key] {
continue
}
w, err := acting.Decode(raw)
if err != nil {
continue
}
if _, there := trunk[w.Module]; there && !p.orderVisited[w.Module] {
continue // the module was not looked at in this pass (no pipeline passed for it yet): its wait stands as kept
}
how := acting.HowRan
switch e, there := p.orders[key]; {
case w.Released:
how = acting.HowReleased
case there && e.fp != w.Fp, !there && wanted[w.Module][w.Node].Fp != w.Entry:
how = acting.HowReplaced
}
if !w.EndSaid {
body := acting.Body(w, assignment.Module())
body.How = how
if err := p.wantsSay(seat.EventWaitEnded, body, key+"."+w.Fp+"."+w.Entry+"."+how); err != nil {
p.logf("the end of the wait of %s on %s for %s is not said, and is said at the next pass: %v", w.Module, w.Node, w.Part, err)
continue
}
}
p.remove(ctx, buckets.Waits(), key)
delete(p.orderSaid, key)
}
}
@@ -0,0 +1,351 @@
package main
import (
"context"
"encoding/json"
"fmt"
"strings"
"testing"
"time"
mmac "git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient"
"git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
"git.novox.be/novox/mesh-contracts/go/seats/meshbroker"
mma "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
"git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
oc "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/seats/operatorchannel"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
mwc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshwantsclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshdelivery"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-delivery/modules/mesh-grants/grantsstate"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-sdk/go/seatdef"
"mesh-delivery-assigner/internal/acting"
"mesh-delivery-assigner/internal/assigngraph"
plc "mesh-delivery-assigner/internal/assignment"
"mesh-delivery-assigner/internal/buckets"
)
// orderFP is a fingerprint of the form the trunk keeps, made of one letter.
func orderFP(c string) string {
return meshcatalogclient.SourcePrefix2 + strings.Repeat(fmt.Sprintf("%x", c[0]&15), 64)
}
// orderMod is one module of an order test: the fingerprint it runs on ace and the one the trunk holds, the form of its kept data at each
// fingerprint (0: it keeps none), the seats it holds and the source revision of its trunk value.
type orderMod struct {
name string
run, trunk string
forms map[string]int
holds []string
src int64
}
type orderFixture struct {
t *testing.T
p *passer
wants *memKV
events []string
bodies []meshwants.Wait
answers chan struct{}
}
// newOrderFixture is a pass on node ace, which composes its own modules, with each module running its fingerprint healthy, built and
// granted at the trunk's, an older want, the catalog's entries answered and each held seat as the assignments say it. history lists the
// fingerprints of each module by assignment graph revision, oldest first (the objects Reverted reads).
func newOrderFixture(t *testing.T, mods []orderMod, history ...map[string]string) *orderFixture {
t.Helper()
ctx := context.Background()
f := &orderFixture{t: t, wants: &memKV{values: map[string][]byte{}}, answers: make(chan struct{}, 64)}
f.p = newPasser(kvSet{buckets.Wants(): f.wants, buckets.Asks(): &memKV{values: map[string][]byte{}}, buckets.Waits(): &memKV{values: map[string][]byte{}}}, time.Now())
p := f.p
p.logf = t.Logf
p.say = func(oc.Condition) error { return nil }
p.publishWants = func(event string, body any, id string) error {
f.events = append(f.events, event)
f.bodies = append(f.bodies, body.(meshwants.Wait))
return nil
}
digest := "sha256:" + strings.Repeat("c", 64)
pl := mma.Assignments{Node: "ace"}
forms := map[string]int{} // by fingerprint: each module's own
modules := []string{}
for _, m := range mods {
modules = append(modules, m.name)
pl.Modules = append(pl.Modules, mma.PlacedModule{Module: m.name})
for _, seat := range m.holds {
scope := "node"
if seat != catalogue.BackupSeat && seat != nodeengine.Seat {
scope = "mesh"
}
pl.Holds = append(pl.Holds, mma.Holding{Claim: seat, Module: m.name, Scope: scope})
}
for fp, form := range m.forms {
forms[fp] = form
}
mdigest := fmt.Sprintf("%064x", len(modules))
mod, _ := meshcatalogclient.EncodeModule(meshcatalog.ModulesByModuleValue{Fp2: m.trunk, Manifest: mdigest, Repository: "novox/" + m.name, Commit: strings.Repeat("1", 40), Path: meshcatalogclient.RootPath, Src: m.src})
putModuleRaw(p.w, trunkBranch, m.name, mod)
p.w.manifests[mdigest] = parsed{module: m.name, manifest: catalogue.Manifest{Module: m.name}}
endDone(t, p.w, m.name, m.trunk, mdigest)
gkey, _ := grantsstate.PartGrantKey(m.name, m.trunk)
grant, _ := grantsstate.EncodeGrant(grantsstate.Grant{})
p.w.put(buckets.Grants, gkey, grant)
f.runs(m.name, m.run)
wkey, _ := mwc.WantKey("ace", m.name)
old, _ := mwc.EncodeWant(mwc.Want{Fp: m.run, Self: true})
p.w.put(buckets.Wants(), wkey, old)
f.wants.values[wkey] = old
}
composes(t, p.w, "ace", digest)
values, err := mmac.AssignmentsValues(pl)
if err != nil {
t.Fatal(err)
}
for key, raw := range values {
p.w.put(plc.AssignmentsBucket(), key, raw)
}
p.w.heardPresence("ace", false, time.Now()) // ace is online: its last presence event heard is machine-back
objects := memObjects{}
for i, at := range history {
half := meshcatalogclient.Half{Revision: meshcatalog.CatalogRevision{Branch: trunkBranch, Kind: "trunk", Revision: int64(i + 1), Source: int64(i + 1)},
Entries: map[string]meshcatalog.CatalogEntry{}}
for _, module := range modules {
digest := fmt.Sprintf("sha256:%064x", (i+1)*1000+len(half.Entries))
half.Revision.Entries = append(half.Revision.Entries, meshcatalog.EntryRef{Module: module, Digest: digest})
half.Entries[module] = meshcatalog.CatalogEntry{Module: module, Fp: at[module]}
}
placed := mma.Assignments{Node: "ace"}
for _, module := range modules {
placed.Modules = append(placed.Modules, mma.PlacedModule{Module: module})
}
in := assigngraph.Inputs{Halves: map[string]meshcatalogclient.Half{trunkBranch: half}, FirstBranch: func(string) string { return trunkBranch },
Placements: map[string]mma.Assignments{"ace": placed}}
if _, _, err := assigngraph.Keep(ctx, objects, assigngraph.Compute(in), "test", time.Now()); err != nil {
t.Fatal(err)
}
}
p.graph = &graphKeeper{objects: objects}
p.entries = meshcatalogclient.NewEntries(func(_ string, body any) (json.RawMessage, error) {
in := body.(meshcatalog.EntryInput)
entry := meshcatalog.CatalogEntry{Module: "m", Fp: in.Fingerprint, Manifest: map[string]any{"module": "m"}}
if form := forms[in.Fingerprint]; form > 0 {
entry.Manifest = map[string]any{"module": "m", "state": []any{map[string]any{"name": "sessions", "form": form}}}
}
return json.Marshal(meshcatalog.EntryAnswer{Entry: entry})
})
p.entries.Changed = func(meshcatalogclient.EntryRow) { f.answers <- struct{}{} }
return f
}
// runs says module runs fp healthy on ace, heard as the node-engine seat's running and in the have.
func (f *orderFixture) runs(module, fp string) {
have, _ := nodeengineclient.EncodeHave(nodeengine.HaveByNodeModuleValue{Fp: fp, Composed: "sha256:" + strings.Repeat("c", 64), Phase: nodeengineclient.PhaseRunning, Health: nodeengineclient.HealthOK})
f.p.w.put(buckets.Have, "ace."+module, have)
f.p.w.running["ace."+module] = nodeengine.Running{Node: "ace", Module: module, Fingerprint: fp}
}
// pass makes a pass, and after it every catalog entry it asked is answered.
func (f *orderFixture) pass() {
f.t.Helper()
f.p.wants(context.Background())
asked := 0
for _, row := range f.p.entries.Rows() {
if row.State == meshcatalogclient.EntryAsked {
asked++
}
}
for range asked {
select {
case <-f.answers:
case <-time.After(10 * time.Second): // a bound on a failure only: the answers come at once
f.t.Fatal("an entry asked was not answered")
}
}
}
// wantAt is the fingerprint module is wanted at on ace.
func (f *orderFixture) wantAt(module string) string {
f.t.Helper()
key, _ := mwc.WantKey("ace", module)
w, err := mwc.DecodeWant(f.wants.values[key])
if err != nil {
f.t.Fatal(err)
}
return w.Fp
}
func (f *orderFixture) waits() []string {
var out []string
for key := range f.p.w.read(buckets.Waits()) {
if acting.IsOrder(key) {
out = append(out, key)
}
}
return out
}
// Design 47 G §298 first edge, A-258, A-259: a module whose kept data's form changes is not moved until the new version of the node-backup
// holder and of the holder of the seat mesh-broker run; the wait is kept under `order.` in the state waits, said as wait-held, and ends
// ran (wait-ended) when the holders run; a module whose kept data keeps its form is moved at once.
func TestAModuleWhoseKeptDataChangesFormWaitsForTheNewBackupHolderAndTheBusModule(t *testing.T) {
f := newOrderFixture(t, []orderMod{
{name: "web", run: orderFP("a"), trunk: orderFP("b"), forms: map[string]int{orderFP("a"): 1, orderFP("b"): 2}},
{name: "plain", run: orderFP("c"), trunk: orderFP("d"), forms: map[string]int{orderFP("c"): 1, orderFP("d"): 1}},
{name: "backup", run: orderFP("e"), trunk: orderFP("f"), holds: []string{catalogue.BackupSeat}},
{name: "bus", run: orderFP("g"), trunk: orderFP("h"), holds: []string{meshbroker.Seat}},
})
f.pass() // the entries are asked: no want crosses a form change unread
if got := f.wantAt("web"); got != orderFP("a") {
t.Fatalf("web is wanted at %s before the entries are read", got)
}
f.pass()
if got := f.wantAt("web"); got != orderFP("a") {
t.Fatalf("web moved across a form change at %s while the new node-backup holder and bus module do not run", got)
}
if got := f.wantAt("plain"); got != orderFP("d") {
t.Errorf("a module whose kept data keeps its form is wanted at %s, not moved", got)
}
if len(f.waits()) != 2 || len(f.events) != 2 || f.events[0] != meshwants.EventWaitHeld || f.bodies[0].Step != seatdef.StepPlace || f.bodies[0].Module != "web" {
t.Fatalf("waits %v events %v bodies %+v: want two wait-held in the step place, `order.ace.web.backup` and `order.ace.web.bus`", f.waits(), f.events, f.bodies)
}
if _, err := acting.Decode(f.p.w.read(buckets.Waits())[acting.OrderKey("ace", "web", "backup")]); err != nil {
t.Fatalf("the wait is not kept under its key: %v", err)
}
f.pass()
if len(f.events) != 2 {
t.Fatalf("a pass that changed nothing said %v", f.events)
}
f.runs("backup", orderFP("f"))
f.pass()
if got := f.wantAt("web"); got != orderFP("a") || len(f.events) != 3 || f.events[2] != meshwants.EventWaitEnded || f.bodies[2].How != acting.HowRan {
t.Fatalf("with the bus module still old: web at %s, events %v", got, f.events)
}
f.runs("bus", orderFP("h"))
f.pass()
f.pass()
if got := f.wantAt("web"); got != orderFP("b") || len(f.waits()) != 0 || len(f.events) != 4 {
t.Fatalf("with both running: web at %s, waits %v, events %v", got, f.waits(), f.events)
}
}
// §298 first edge, the hand: assigner_waits reads an order wait and assigner_release with how `now` lets the module move.
func TestAnOrderWaitIsReadAndReleasedByTheExistingTools(t *testing.T) {
f := newOrderFixture(t, []orderMod{
{name: "web", run: orderFP("a"), trunk: orderFP("b"), forms: map[string]int{orderFP("a"): 1, orderFP("b"): 2}},
{name: "backup", run: orderFP("e"), trunk: orderFP("f"), holds: []string{catalogue.BackupSeat}},
})
f.pass()
f.pass()
var acts []string
s := newPutTools(memStore{waitsState: f.p.kvs[buckets.Waits()].(*memKV), buckets.DeliveryWaitsState: &memKV{values: map[string][]byte{}}, buckets.DeliveredAgainState: &memKV{values: map[string][]byte{}}}, func(key string, body any) (json.RawMessage, error) {
acts = append(acts, key)
return json.RawMessage(`{"ok":true,"log":"logged"}`), nil
})
got, err := s.doWaits(map[string]any{"module": "web"})
if list := got.(map[string]any)["waits"].([]any); err != nil || len(list) != 1 || list[0].(actingSaid).Key != "order.ace.web.backup" {
t.Fatalf("assigner_waits = %+v %v", got, err)
}
if _, err := s.doRelease(map[string]any{"node": "ace", "module": "web", "how": "now", "why": "the restore point is taken by hand"}, "shanks.node-tools"); err != nil || len(acts) == 0 {
t.Fatalf("%v %v", err, acts)
}
f.p.w.put(buckets.Waits(), "order.ace.web.backup", f.p.kvs[buckets.Waits()].(*memKV).values["order.ace.web.backup"])
f.pass()
f.pass()
if got := f.wantAt("web"); got != orderFP("b") || f.bodies[len(f.bodies)-1].How != acting.HowReleased {
t.Fatalf("after the release: web at %s, last %+v", got, f.bodies[len(f.bodies)-1])
}
}
// §298 second edge, A-259: at a revert the node-engine goes back last on its node, after every module that is set back there across a
// form change runs the reverted build.
func TestAtARevertTheNodeEngineGoesBackLast(t *testing.T) {
old, now := map[string]string{"web": orderFP("a"), "engine": orderFP("c")}, map[string]string{"web": orderFP("b"), "engine": orderFP("d")}
f := newOrderFixture(t, []orderMod{
{name: "web", run: orderFP("b"), trunk: orderFP("a"), forms: map[string]int{orderFP("a"): 1, orderFP("b"): 2}},
{name: "engine", run: orderFP("d"), trunk: orderFP("c"), holds: []string{nodeengine.Seat}},
}, old, now)
f.pass()
f.pass()
if f.wantAt("web") != orderFP("a") {
t.Fatalf("web is wanted at %s: the module set back is not held", f.wantAt("web"))
}
if got := f.wantAt("engine"); got != orderFP("d") {
t.Fatalf("the node-engine is set back to %s before web runs its reverted build", got)
}
if w := f.waits(); len(w) != 1 || w[0] != "order.ace.engine.web" || f.bodies[len(f.bodies)-1].Module != "engine" {
t.Fatalf("waits %v bodies %+v", w, f.bodies)
}
f.runs("web", orderFP("a"))
f.pass()
f.pass()
if got := f.wantAt("engine"); got != orderFP("c") || len(f.waits()) != 0 {
t.Fatalf("with web back: the node-engine is wanted at %s, waits %v", got, f.waits())
}
}
// §298 third edge, A-259, A-260: the reverted assigner and gate are wanted only once the indexer's take-in.taken of the trunk branch names a
// source revision at least the trunk's head (the highest src of the trunk's module values).
func TestTheRevertedAssignerAndGateWaitForTheIndexerToTakeInTheTrunksHead(t *testing.T) {
old, now := map[string]string{"asg": orderFP("a"), "gate": orderFP("c"), "idx": orderFP("e")}, map[string]string{"asg": orderFP("b"), "gate": orderFP("d"), "idx": orderFP("f")}
f := newOrderFixture(t, []orderMod{
{name: "asg", run: orderFP("b"), trunk: orderFP("a"), holds: []string{mma.Seat}, src: 6},
{name: "gate", run: orderFP("d"), trunk: orderFP("c"), holds: []string{meshdelivery.Seat}, src: 7},
{name: "idx", run: orderFP("e"), trunk: orderFP("e"), src: 7},
}, old, now)
f.pass()
f.pass()
if f.wantAt("asg") != orderFP("b") || f.wantAt("gate") != orderFP("d") {
t.Fatalf("the reverted assigner (%s) and gate (%s) are wanted before the head is taken in", f.wantAt("asg"), f.wantAt("gate"))
}
if len(f.waits()) != 2 || f.bodies[0].Part != "mesh-delivery-indexer" {
t.Fatalf("waits %v bodies %+v", f.waits(), f.bodies)
}
taken := func(branch string, source int64) {
raw, _ := json.Marshal(meshcatalog.TakeInTaken{Kind: "taken", Key: "m.1", Branch: branch, Source: source})
if err := f.p.w.taken.put(raw); err != nil {
t.Fatal(err)
}
}
taken("beta", 9) // another branch, and
taken(trunkBranch, 6)
f.pass()
if f.wantAt("asg") != orderFP("b") {
t.Fatal("a source revision before the trunk's head was taken in, and the assigner was wanted")
}
taken(trunkBranch, 7)
f.pass()
f.pass()
if f.wantAt("asg") != orderFP("a") || f.wantAt("gate") != orderFP("c") || len(f.waits()) != 0 {
t.Fatalf("after the head is taken in: asg %s gate %s waits %v", f.wantAt("asg"), f.wantAt("gate"), f.waits())
}
}
// A-260: an order wait still held after a restart is said again as wait-held, by a pass that remembers nothing, and ends at the next
// take-in.taken that names the trunk's head.
func TestAnOrderWaitHeldAfterARestartIsSaidAgain(t *testing.T) {
old, now := map[string]string{"asg": orderFP("a")}, map[string]string{"asg": orderFP("b")}
f := newOrderFixture(t, []orderMod{{name: "asg", run: orderFP("b"), trunk: orderFP("a"), holds: []string{mma.Seat}, src: 7}}, old, now)
f.pass()
f.pass()
if len(f.events) != 1 {
t.Fatalf("events %v", f.events)
}
f.p.orderSaid = nil // a process started again
f.pass()
if len(f.events) != 2 || f.events[1] != meshwants.EventWaitHeld || len(f.waits()) != 1 {
t.Fatalf("events %v waits %v", f.events, f.waits())
}
raw, _ := json.Marshal(meshcatalog.TakeInTaken{Kind: "taken", Key: "m.1", Branch: trunkBranch, Source: 8})
if err := f.p.w.taken.put(raw); err != nil {
t.Fatal(err)
}
f.pass()
f.pass()
if f.wantAt("asg") != orderFP("a") || len(f.waits()) != 0 || f.events[len(f.events)-1] != meshwants.EventWaitEnded {
t.Fatalf("asg at %s, waits %v, events %v", f.wantAt("asg"), f.waits(), f.events)
}
}
@@ -0,0 +1,499 @@
package main
import (
"context"
"encoding/json"
"errors"
"fmt"
"io/fs"
"os"
"strconv"
"strings"
"sync"
"time"
"github.com/nats-io/nats.go"
"github.com/nats-io/nats.go/jetstream"
"git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
"git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
mcseat "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-assigner/asks"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/catalogkey"
"git.novox.be/novox/mesh-sdk/go/seatdef"
"git.novox.be/novox/mesh-sdk/go/views"
"mesh-delivery-assigner/internal/assign"
"mesh-delivery-assigner/internal/assignment"
"mesh-delivery-assigner/internal/buckets"
"mesh-delivery-assigner/internal/outside"
)
// The wait on an outside cause (design 47 G §706, ADR 0677): the assigner judges a node's health after a want moves, and a moved
// module's failing check on a machine whose open conditions name an outside cause is held as a wait (internal/outside has the
// rules). The conditions come only through the seat mesh-conditions: its verb `conditions`, read at each judging as a kept
// call, and its events, which only say when to judge again.
// conditionsVerb is the seat verb the keeper answers `conditions` by.
const conditionsVerb = "seat:" + mcseat.Seat + "." + mcseat.VerbConditions
// wantsPublisher says one of the seat mesh-wants' events, `wait-held` and `wait-ended` among them, under a message id the bus
// keeps one of.
func wantsPublisher(ctx context.Context, js jetstream.JetStream, node string) publisher {
return func(event string, body any, id string) error {
data, err := json.Marshal(body)
if err != nil {
return err
}
msg := nats.NewMsg(seatdef.EventSubject(meshwants.Seat, event))
msg.Header.Set("x-event-id", id)
msg.Header.Set("x-source", assignment.Module())
msg.Header.Set("x-node", node)
msg.Header.Set("x-time", time.Now().UTC().Format(time.RFC3339Nano))
msg.Header.Set("content-type", "application/json")
msg.Data = data
_, err = js.PublishMsg(ctx, msg, jetstream.WithMsgID(id))
return err
}
}
// outsideActs keeps, while the process runs, what the judging of outside waits needs beside the kept waits: the conditions read
// for each machine (one answer is one judging), the machines a heard event says to judge again, the machines whose own network
// is held open, and each check's last signature.
type outsideActs struct {
mu sync.Mutex
call func(key string, body any) (json.RawMessage, error) // a kept call
wake func()
logf func(string, ...any)
// bound and settle are the settings outside-wait-minutes and outside-settle-seconds.
bound, settle time.Duration
// reading is a read in flight by machine, answered the answers it brought, not yet judged by.
reading map[string]bool
answered map[string][]outside.Cond
// dirty is a machine whose waits are judged again, cleared a wait's key whose cause's clearing was heard.
dirty map[string]bool
cleared map[string]bool
// sigs is each check's last signature, by node.module.
sigs map[string]string
// own is the machines whose own network is open; ownRead says the read at the start was answered.
own map[string]bool
ownRead bool
// causes is, by condition key, the nodes whose waits stand on it, as the last pass kept them.
causes map[string][]string
// started says the first pass judged every wait again.
started bool
}
func newOutsideActs(call func(string, any) (json.RawMessage, error), wake func(), logf func(string, ...any), bound, settle time.Duration) *outsideActs {
if bound <= 0 {
bound = outside.DefaultBound
}
if settle <= 0 {
settle = outside.DefaultSettle
}
return &outsideActs{call: call, wake: wake, logf: logf, bound: bound, settle: settle, reading: map[string]bool{}, answered: map[string][]outside.Cond{},
dirty: map[string]bool{}, cleared: map[string]bool{}, sigs: map[string]string{}, own: map[string]bool{}, causes: map[string][]string{}}
}
// outsideSettings are the bounds of the wait, the settings outside-wait-minutes and outside-settle-seconds (design 47 G §633, §706),
// each read at the start from the file the manifest declares with the content ${config:<key>}, which the environment names
// (A-112, as the builder reads its own); zero for one whose file is missing or empty, which is its default, and an error
// naming the file for a content that is no positive whole number.
func outsideSettings(getenv func(string) string) (bound, settle time.Duration, err error) {
minutes, err := settingFile(getenv("MESH_ASSIGNER_OUTSIDE_WAIT_FILE"))
if err != nil {
return 0, 0, err
}
seconds, err := settingFile(getenv("MESH_ASSIGNER_OUTSIDE_SETTLE_FILE"))
if err != nil {
return 0, 0, err
}
return time.Duration(minutes) * time.Minute, time.Duration(seconds) * time.Second, nil
}
// settingFile reads one setting's file: 0 for no path, no file or an empty one.
func settingFile(path string) (int, error) {
if path == "" {
return 0, nil
}
raw, err := os.ReadFile(path)
if errors.Is(err, fs.ErrNotExist) {
return 0, nil
}
if err != nil {
return 0, err
}
v := strings.TrimSpace(string(raw))
if v == "" {
return 0, nil
}
n, err := strconv.Atoi(v)
if err != nil || n < 1 {
return 0, fmt.Errorf("%s holds %q, which is not a positive whole number", path, v)
}
return n, nil
}
// readStart reads the open conditions of every machine once at the start, for the machines whose own network is held.
func (o *outsideActs) readStart() {
go func() {
answer, err := o.call(conditionsVerb, map[string]any{"scope": "machine"})
if err != nil {
o.logf("the open conditions are not read at the start (%v): no machine is held for its own network until its event is heard", err)
return
}
conds, err := outside.ParseConditions(answer)
if err != nil {
o.logf("%v", err)
return
}
o.mu.Lock()
for m := range outside.OwnNetwork(conds) {
o.own[m] = true
}
o.ownRead = true
o.mu.Unlock()
o.wake()
}()
}
// Heard is one of the seat's events condition-raised, -changed or -cleared: it says which machines to judge again and keeps the
// machines whose own network is open; nothing is kept of the condition.
func (o *outsideActs) Heard(subject string, body []byte) {
var e mcseat.ConditionEvent
if err := json.Unmarshal(body, &e); err != nil || e.Key == "" {
o.logf("%s holds what is not a condition's event, and is dropped: %v", subject, err)
return
}
cleared := strings.HasSuffix(subject, "."+mcseat.EventConditionCleared)
o.mu.Lock()
if p := strings.Split(e.Key, "."); len(p) == 3 && p[0] == "machine" && p[2] == "network" {
o.own[p[1]] = !cleared
}
if cleared {
for _, node := range o.causes[e.Key] {
o.dirty[node] = true
o.cleared[node+"|"+e.Key] = true
}
} else if e.Subject != nil {
o.dirty[e.Subject.Machine] = true
for _, m := range e.Subject.Also {
o.dirty[m] = true
}
}
o.mu.Unlock()
o.wake()
}
// Held says whether machine's own network is open: no want moves to it.
func (o *outsideActs) Held(machine string) bool {
if o == nil {
return false
}
o.mu.Lock()
defer o.mu.Unlock()
return o.own[machine]
}
// take is the conditions read for machine, consumed (one answer is one judging), or false while the kept call is unanswered,
// which it starts when none is in flight.
func (o *outsideActs) take(machine string) ([]outside.Cond, bool) {
o.mu.Lock()
defer o.mu.Unlock()
if c, ok := o.answered[machine]; ok {
delete(o.answered, machine)
return c, true
}
if o.reading[machine] {
return nil, false
}
o.reading[machine] = true
go func() {
answer, err := o.call(conditionsVerb, map[string]any{"scope": "machine", "machine": machine})
var conds []outside.Cond
if err == nil {
conds, err = outside.ParseConditions(answer)
}
o.mu.Lock()
o.reading[machine] = false
if err != nil {
o.logf("the conditions of %s are not read (%v): the move waits on %s", machine, err, outside.OnUnread)
} else {
o.answered[machine] = conds
o.dirty[machine] = true // the kept call answered: the move is judged by it
}
o.mu.Unlock()
if err == nil {
o.wake()
}
}()
return nil, false
}
// outsideReview is the judging of module's check at fp on each of its nodes (§706): it returns the nodes as the rules read them,
// the have of a waiting move no failure (its health unknown) and a go-on's counted healthy, and keeps the waits, says their
// events, finding and ask. moved says the delivery moved owner to node.
func (p *passer) outsideReview(ctx context.Context, module, fp string, nodes []string, n assign.Nodes, keeperSelf bool, moved func(owner, node string) bool) assign.Nodes {
o := p.outside
if o == nil || fp == "" || p.kvs[buckets.Waits()] == nil {
return n
}
hex, err := catalogkey.KeyPart(fp)
if err != nil {
return n
}
now := p.clock()
kept := p.w.read(buckets.Waits())
override := map[string]string{}
// A wait of another fingerprint of this module is replaced by the newer want.
for key, raw := range kept {
if w, err := outside.Decode(raw); err == nil && w.Module == module && w.FP != fp {
p.outsideEnd(ctx, key, w, outside.HowReplaced, now)
}
}
for _, node := range nodes {
key := outside.Key(node, module, hex)
var prev *outside.Wait
if raw := kept[key]; raw != nil {
if w, err := outside.Decode(raw); err == nil {
prev = &w
}
}
h, ok := n.Haves[node][module]
sig := fmt.Sprintf("%s|%s|%s", h.Fp, h.Phase, h.Health)
o.mu.Lock()
first := !o.started
changed := o.sigs[node+"."+module] != sig
o.sigs[node+"."+module] = sig
dirty := o.dirty[node]
cleared := prev != nil && prev.Cause != "" && o.cleared[node+"|"+prev.Cause]
o.mu.Unlock()
failing, healthy := ok && h.Fp == fp && assign.Failed(h), n.RunsHealthy(node, module, fp)
if !failing && !healthy && prev == nil {
continue
}
if prev != nil && p.outsideAnswered(prev, node, module, fp) {
dirty = true
}
due := prev != nil && (prev.Release != "" || (prev.Settling && !now.Before(prev.SettleEnds)))
var d outside.Decision
if prev != nil && !(first || changed || dirty || due) {
// nothing to judge by: the wait stands as kept; the bound's ask is made when it has run
d = outside.Decision{Wait: prev, Waiting: prev.Standing() || prev.Settling, Own: prev.Decided == outside.HowFailed || prev.Decided == outside.HowOwnFailure,
Counted: prev.Decided == outside.HowGoOn}
if prev.Standing() && !now.Before(prev.ClockFrom.Add(o.bound)) {
d.Ask = true
}
} else {
f := outside.Facts{Now: now, Failing: failing, Healthy: healthy, Node: node, KeeperSelf: keeperSelf, Bound: o.bound, Settle: o.settle,
Moved: func(owner string) bool { return moved(owner, node) }, CauseCleared: cleared}
if failing && !keeperSelf {
f.Conds, f.Read = o.take(node)
}
d = outside.Judge(prev, node, module, fp, f)
o.mu.Lock()
delete(o.dirty, node)
if prev != nil {
delete(o.cleared, node+"|"+prev.Cause)
}
o.mu.Unlock()
}
switch {
case d.Waiting:
override[node] = nodeengineclient.HealthUnknown
case d.Counted:
override[node] = nodeengineclient.HealthOK
}
p.outsideApply(ctx, key, hex, node, module, fp, prev, d, now)
}
o.mu.Lock()
o.started = true
o.mu.Unlock()
if len(override) == 0 {
return n
}
out := n
out.Haves = map[string]map[string]nodeengine.HaveByNodeModuleValue{}
for node, byModule := range n.Haves {
out.Haves[node] = map[string]nodeengine.HaveByNodeModuleValue{}
for m, h := range byModule {
out.Haves[node][m] = h
}
}
for node, health := range override {
h := out.Haves[node][module]
h.Health = health
if health == nodeengineclient.HealthOK {
h.Phase = nodeengineclient.PhaseRunning
}
out.Haves[node][module] = h
}
return out
}
// outsideAnswered reads the operator's answer to the wait's ask, from the teller's record of it under the ask's key (answeredWith,
// §700's path as the assigner reads an ask's answer), and notes it on the wait as a release; it says whether it did.
func (p *passer) outsideAnswered(w *outside.Wait, node, module, fp string) bool {
if w.Ask == "" || w.Release != "" {
return false
}
key, err := asks.OutsideAskKey(node, module, fp)
if err != nil {
return false
}
for _, how := range []string{assign.OptionGoOn, assign.OptionFailed} {
if p.answeredWith(key, how) {
w.Release, w.By, w.Why = how, "the operator", "the answer to the ask "+w.Ask
return true
}
}
return false
}
// outsideApply keeps what a judging came to: the wait's record, its events, its finding and its ask.
func (p *passer) outsideApply(ctx context.Context, key, hex, node, module, fp string, prev *outside.Wait, d outside.Decision, now time.Time) {
o := p.outside
switch {
case d.End != "":
p.outsideEnd(ctx, key, *prev, d.End, now)
if d.Wait != nil {
p.keepWait(ctx, key, *d.Wait)
}
return
case d.Wait == nil:
if prev != nil {
p.outsideEnd(ctx, key, *prev, "", now)
}
return
}
w := *d.Wait
if d.Held {
body := p.outsideBody(w)
if err := p.wantsSay(meshwants.EventWaitHeld, body, key+"."+w.On+"."+w.ClockFrom.UTC().Format(time.RFC3339Nano)); err != nil {
p.logf("the wait of %s on %s is not said, and is said at the next pass: %v", module, node, err)
return
}
p.outsideFinding(w, true)
}
if d.Ask && w.Ask == "" {
if id := p.outsideAsk(ctx, node, module, fp, w, now); id != "" {
w.Ask = id
}
}
if w.Standing() || w.Settling || w.Decided != "" {
o.mu.Lock()
if w.Cause != "" && w.Standing() {
if !containsString(o.causes[w.Cause], node) {
o.causes[w.Cause] = append(o.causes[w.Cause], node)
}
}
o.mu.Unlock()
if w.Settling {
p.wakeAt(w.SettleEnds, now)
} else if w.Standing() {
p.wakeAt(w.ClockFrom.Add(o.bound), now)
}
p.keepWait(ctx, key, w)
}
}
func containsString(l []string, s string) bool {
for _, x := range l {
if x == s {
return true
}
}
return false
}
// keepWait writes the wait's record.
func (p *passer) keepWait(ctx context.Context, key string, w outside.Wait) {
p.put(ctx, buckets.Waits(), key, func() ([]byte, error) { return outside.Encode(w) })
}
func (p *passer) outsideBody(w outside.Wait) meshwants.Wait {
since, from := w.Since, w.ClockFrom
return meshwants.Wait{Step: meshwants.WaitStepOutside, Owner: assignment.Module(), Node: w.Node, Module: w.Module, Fingerprint: w.FP, On: w.On,
Since: since, ClockFrom: &from, Bound: w.Bound,
Words: fmt.Sprintf("%s on %s waits on %s", w.Module, w.Node, w.On)}
}
// outsideEnd ends a wait: its wait-ended with how (none for a settle, which was never said), its finding and ask taken away, and
// its record deleted unless the end decided it (the caller keeps that record).
func (p *passer) outsideEnd(ctx context.Context, key string, w outside.Wait, how string, now time.Time) {
if w.Standing() && how != "" {
body := p.outsideBody(w)
body.How = how
if err := p.wantsSay(meshwants.EventWaitEnded, body, key+"."+how+"."+now.UTC().Format(time.RFC3339Nano)); err != nil {
p.logf("the end of the wait of %s on %s is not said, and is said at the next pass: %v", w.Module, w.Node, err)
return
}
}
p.outsideFinding(w, false)
if ask, err := asks.OutsideAskKey(w.Node, w.Module, w.FP); err == nil {
p.remove(ctx, buckets.Asks(), ask)
}
if p.outside != nil && w.Cause != "" {
p.outside.mu.Lock()
p.outside.causes[w.Cause] = removeString(p.outside.causes[w.Cause], w.Node)
p.outside.mu.Unlock()
}
p.remove(ctx, buckets.Waits(), key)
}
func removeString(l []string, s string) []string {
var out []string
for _, x := range l {
if x != s {
out = append(out, x)
}
}
return out
}
// outsideFinding writes the finding delivery-waits-outside, or clears it.
func (p *passer) outsideFinding(w outside.Wait, raised bool) {
if p.findings.Put == nil {
return
}
o := assign.WaitsOutsideFinding(w.Node, w.Module, w.Cause, w.On, p.clock())
if raised {
if err := p.findings.Put(o.Finding(p.clock())); err != nil {
p.logf("the finding %s is not written: %v", "delivery."+o.ID, err)
}
return
}
if p.findings.Delete != nil {
if err := p.findings.Delete(mcseatKey(o)); err != nil {
p.logf("the finding %s is not cleared: %v", "delivery."+o.ID, err)
}
}
}
func mcseatKey(o assign.Observed) string {
return views.FindingKey(o.Scope, assign.KeyID(o.ID), o.Kind)
}
// outsideAsk asks the operator at the wait's bound, once, and returns the asking's id.
func (p *passer) outsideAsk(ctx context.Context, node, module, fp string, w outside.Wait, now time.Time) string {
key, err := asks.OutsideAskKey(node, module, fp)
if err != nil {
return ""
}
asking := assign.AskingSeconds(now)
a := assign.OutsideAsk(key, asks.OutsideAbout(key), node, module, fp, w.On, w.ClockFrom, asking, now)
p.put(ctx, buckets.Asks(), key, func() ([]byte, error) { return assign.EncodeAsk(key, a) })
if ask, err := assign.AskOf(a); err == nil {
return ask.ID
}
return ""
}
// wakeAt makes a pass when t comes: the settle's end and the bound are the waits' own times, the one wake (no polling).
func (p *passer) wakeAt(t, now time.Time) {
if p.outside == nil || p.outside.wake == nil {
return
}
time.AfterFunc(max(t.Sub(now), 0)+time.Millisecond, p.outside.wake)
}
@@ -0,0 +1,333 @@
package main
import (
"context"
"encoding/json"
"os"
"path/filepath"
"strings"
"testing"
"time"
"git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
"git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
mcseat "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-assigner/asks"
mdc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshdeliveryclient"
meshwants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"mesh-delivery-assigner/internal/assign"
"mesh-delivery-assigner/internal/buckets"
"mesh-delivery-assigner/internal/outside"
)
// The whole of the wait on an outside cause in the pass (design 47 G §706): a fixture keeper answering `conditions` and saying
// its events, a failing check of nats on ace, and the events, finding, ask and record the pass leaves.
type outsideRig struct {
t *testing.T
p *passer
now time.Time
conds []map[string]any
unread bool
events []string
bodies []meshwants.Wait
found map[string]bool
woke chan struct{}
health string
}
func newOutsideRig(t *testing.T) *outsideRig {
r := &outsideRig{t: t, now: time.Date(2026, 11, 11, 10, 0, 0, 0, time.UTC), found: map[string]bool{}, woke: make(chan struct{}, 16), health: nodeengineclient.HealthFailed}
r.p = newPasser(kvSet{buckets.Waits(): &memKV{values: map[string][]byte{}}, buckets.Asks(): &memKV{values: map[string][]byte{}}}, r.now)
r.p.now = func() time.Time { return r.now }
r.p.w.put(buckets.Asks(), "x", nil)
r.p.outside = newOutsideActs(func(key string, body any) (json.RawMessage, error) {
if r.unread {
return nil, context.DeadlineExceeded
}
return json.Marshal(map[string]any{"conditions": r.conds})
}, func() { r.woke <- struct{}{} }, func(string, ...any) {}, 30*time.Minute, 90*time.Second)
r.p.publishWants = func(event string, body any, id string) error {
r.events = append(r.events, event)
r.bodies = append(r.bodies, body.(meshwants.Wait))
return nil
}
r.p.findings.Put = func(f mcseat.Finding) error { r.found[f.Scope+"."+f.ID+"."+f.Kind] = true; return nil }
r.p.findings.Delete = func(key string) error { delete(r.found, key); return nil }
return r
}
func (r *outsideRig) cond(key string, also ...string) {
r.conds = append(r.conds, map[string]any{"key": key, "subject": map[string]any{"machine": strings.Split(key, ".")[1], "also": also}})
}
// review is one pass's judging of nats on ace at the fingerprint, with the read answered at once when one is started.
func (r *outsideRig) review(keeperSelf bool, moved func(string, string) bool) assign.Nodes {
r.t.Helper()
n := assign.Nodes{Online: map[string]bool{"ace": true}, Haves: map[string]map[string]nodeengine.HaveByNodeModuleValue{
"ace": {"nats": {Fp: fpTest, Phase: nodeengineclient.PhaseRunning, Health: r.health}}}}
healthy := r.health == nodeengineclient.HealthOK
n.Running = map[string]map[string]nodeengine.Running{"ace": {"nats": {Node: "ace", Module: "nats", Fingerprint: fpTest, Healthy: &healthy}}}
if moved == nil {
moved = func(string, string) bool { return false }
}
out := r.p.outsideReview(context.Background(), "nats", fpTest, []string{"ace"}, n, keeperSelf, moved)
select {
case <-r.woke: // the read was answered: the next pass judges by it
out = r.p.outsideReview(context.Background(), "nats", fpTest, []string{"ace"}, n, keeperSelf, moved)
case <-time.After(50 * time.Millisecond):
}
return out
}
func (r *outsideRig) wait() outside.Wait {
r.t.Helper()
for _, v := range r.p.w.read(buckets.Waits()) {
w, err := outside.Decode(v)
if err != nil {
r.t.Fatal(err)
}
return w
}
return outside.Wait{}
}
func TestTheWaitOnAnOutsideCause(t *testing.T) {
healthOf := func(n assign.Nodes) string { return n.Haves["ace"]["nats"].Health }
t.Run("a cause listing the machine is a wait said at once, ended cleared when it clears healthy", func(t *testing.T) {
r := newOutsideRig(t)
r.cond("machine.hub.unreachable", "ace")
n := r.review(false, nil)
if healthOf(n) == nodeengineclient.HealthFailed || len(r.events) != 1 || r.events[0] != meshwants.EventWaitHeld {
t.Fatalf("health %s events %v", healthOf(n), r.events)
}
b := r.bodies[0]
if b.Step != meshwants.WaitStepOutside || b.On != "unreachable:hub" || b.Bound != "30m0s" || b.ClockFrom == nil || !b.ClockFrom.Equal(r.now) || b.Node != "ace" || b.Module != "nats" {
t.Errorf("wait-held %+v", b)
}
if !r.found["delivery.ace.nats.delivery-waits-outside"] {
t.Errorf("findings %v", r.found)
}
// the cause clears and the module runs healthy
r.conds, r.health, r.now = nil, nodeengineclient.HealthOK, r.now.Add(time.Minute)
r.p.outside.Heard("mesh.seat.mesh-conditions.event.condition-cleared", []byte(`{"key":"machine.hub.unreachable","event":"cleared","change":"cleared","at":"2026-11-11T10:01:00Z","subject":{"id":"hub","scope":"machine","machine":"hub","also":["ace"]}}`))
<-r.woke
r.review(false, nil)
if len(r.events) != 2 || r.events[1] != meshwants.EventWaitEnded || r.bodies[1].How != outside.HowCleared || len(r.found) != 0 || len(r.p.w.read(buckets.Waits())) != 0 {
t.Errorf("events %v bodies %+v findings %v", r.events, r.bodies, r.found)
}
})
t.Run("a cause not listing the machine settles, then the failure is the delivery's", func(t *testing.T) {
r := newOutsideRig(t)
r.cond("machine.hub.unreachable", "g14")
n := r.review(false, nil)
if healthOf(n) == nodeengineclient.HealthFailed || len(r.events) != 0 || !r.wait().Settling {
t.Fatalf("settle: health %s events %v wait %+v", healthOf(n), r.events, r.wait())
}
r.now = r.now.Add(91 * time.Second)
if n := r.review(false, nil); healthOf(n) != nodeengineclient.HealthFailed {
t.Errorf("past the settle the check still counts as failing: %s", healthOf(n))
}
})
t.Run("a cause turning into another keeps the wait and its clock; a rewritten naming a moved module fails at once", func(t *testing.T) {
r := newOutsideRig(t)
r.cond("machine.hub.unreachable", "ace")
r.review(false, nil)
r.conds = nil
r.cond("machine.hub.network", "ace")
r.now = r.now.Add(5 * time.Minute)
r.p.outside.Heard("mesh.seat.mesh-conditions.event.condition-raised", []byte(`{"key":"machine.hub.network","subject":{"id":"hub","scope":"machine","machine":"hub","also":["ace"]}}`))
<-r.woke
r.review(false, nil)
last := len(r.bodies) - 1
if len(r.events) != 2 || r.events[last] != meshwants.EventWaitHeld || r.bodies[last].On != "network:hub" || !r.bodies[last].ClockFrom.Equal(*r.bodies[0].ClockFrom) {
t.Errorf("events %v bodies %+v", r.events, r.bodies)
}
r2 := newOutsideRig(t)
r2.cond("machine.ace.nats.rewritten")
n := r2.review(false, func(owner, node string) bool { return owner == "nats" })
if healthOf(n) == nodeengineclient.HealthFailed || !r2.wait().Settling {
t.Errorf("a rewritten of the moved module is its failure: %s %+v", healthOf(n), r2.wait())
}
})
t.Run("the keeper silent waits on conditions-unread, and its own module is judged with no read", func(t *testing.T) {
r := newOutsideRig(t)
r.unread = true
r.review(false, nil)
r.now = r.now.Add(90 * time.Second) // the settle has run with no answer
r.review(false, nil)
if len(r.bodies) != 1 || r.bodies[0].On != outside.OnUnread {
t.Fatalf("bodies %+v", r.bodies)
}
r2 := newOutsideRig(t)
r2.cond("machine.hub.unreachable", "ace")
if n := r2.review(true, nil); healthOf(n) != nodeengineclient.HealthFailed || len(r2.events) != 0 {
t.Errorf("the keeper's own failing check waits: %s %v", healthOf(n), r2.events)
}
})
t.Run("past the bound the operator is asked; Go on counts it healthy and Count as failed holds it, each said ended", func(t *testing.T) {
for how, want := range map[string]string{assign.OptionGoOn: nodeengineclient.HealthOK, assign.OptionFailed: nodeengineclient.HealthFailed} {
r := newOutsideRig(t)
r.cond("machine.hub.silent", "ace")
r.review(false, nil)
r.now = r.now.Add(31 * time.Minute)
r.p.outside.Heard("mesh.seat.mesh-conditions.event.condition-changed", []byte(`{"key":"machine.hub.silent","subject":{"id":"hub","scope":"machine","machine":"hub","also":["ace"]}}`))
<-r.woke
r.review(false, nil)
key, _ := asks.OutsideAskKey("ace", "nats", fpTest)
raw := r.p.w.value(buckets.Asks(), key)
if raw == nil {
t.Fatalf("%s: no ask at %s", how, key)
}
_, ask, err := assign.DecodeAsk(key, raw)
if err != nil || ask.About != "ace.nats."+strings.TrimPrefix(key[strings.LastIndex(key, ".")+1:], "") || len(ask.Options) != 2 {
t.Fatalf("ask %+v %v", ask, err)
}
v, _ := mdc.EncodeAnswer(mdc.Answer{Option: how, Warrant: ask.ID + "@2026-11-11T10:32:00Z", Words: "the operator"})
r.p.w.put(buckets.Answers, key, v)
n := r.review(false, nil)
if r.events[len(r.events)-1] != meshwants.EventWaitEnded || r.bodies[len(r.bodies)-1].How != how || healthOf(n) != want {
t.Errorf("%s: events %v last %+v health %s", how, r.events, r.bodies[len(r.bodies)-1], healthOf(n))
}
if r.p.w.value(buckets.Asks(), key) != nil || len(r.found) != 0 {
t.Errorf("%s: the ask or the finding stands after the end", how)
}
// a check that goes on failing is not waited on again
r.now = r.now.Add(time.Minute)
r.p.outside.Heard("mesh.seat.mesh-conditions.event.condition-raised", []byte(`{"key":"machine.hub.silent","subject":{"id":"hub","scope":"machine","machine":"hub","also":["ace"]}}`))
<-r.woke
before := len(r.events)
r.review(false, nil)
if len(r.events) != before {
t.Errorf("%s: a decided check is waited on again", how)
}
}
})
t.Run("a newer want ends the wait replaced, and a restart judges it again", func(t *testing.T) {
r := newOutsideRig(t)
r.cond("machine.hub.unreachable", "ace")
r.review(false, nil)
n := assign.Nodes{Online: map[string]bool{"ace": true}, Haves: map[string]map[string]nodeengine.HaveByNodeModuleValue{}}
r.p.outsideReview(context.Background(), "nats", "src2:"+strings.Repeat("c", 64), []string{"ace"}, n, false, func(string, string) bool { return false })
if r.events[len(r.events)-1] != meshwants.EventWaitEnded || r.bodies[len(r.bodies)-1].How != outside.HowReplaced {
t.Errorf("events %v", r.events)
}
})
t.Run("its bounds are read at the start from the files the manifest declares (A-112)", func(t *testing.T) {
dir := t.TempDir()
write := func(name, content string) string {
p := filepath.Join(dir, name)
if err := os.WriteFile(p, []byte(content), 0o600); err != nil {
t.Fatal(err)
}
return p
}
env := map[string]string{"MESH_ASSIGNER_OUTSIDE_WAIT_FILE": write("wait", "45\n"), "MESH_ASSIGNER_OUTSIDE_SETTLE_FILE": write("settle", "7")}
if bound, settle, err := outsideSettings(func(k string) string { return env[k] }); err != nil || bound != 45*time.Minute || settle != 7*time.Second {
t.Errorf("bound %v settle %v err %v, want 45m and 7s", bound, settle, err)
}
env["MESH_ASSIGNER_OUTSIDE_WAIT_FILE"], env["MESH_ASSIGNER_OUTSIDE_SETTLE_FILE"] = filepath.Join(dir, "missing"), write("empty", "")
if bound, settle, err := outsideSettings(func(k string) string { return env[k] }); err != nil || bound != 0 || settle != 0 {
t.Errorf("bound %v settle %v err %v, want both defaults", bound, settle, err)
}
env["MESH_ASSIGNER_OUTSIDE_SETTLE_FILE"] = write("bad", "soon")
if _, _, err := outsideSettings(func(k string) string { return env[k] }); err == nil || !strings.Contains(err.Error(), "bad") {
t.Errorf("err %v, want one naming the file", err)
}
})
}
func TestAMachineWhoseOwnNetworkIsOpenGetsNoWant(t *testing.T) {
m := assign.Module{Name: "nats", FP: fpTest, Built: true, Nodes: []string{"ace"}, MachineHeld: func(node string) bool { return node == "ace" }}
ok, rule, why := assign.Holds(m, "ace", assign.Nodes{Online: map[string]bool{"ace": true}})
if ok || rule == 0 || !strings.Contains(why, "machine.ace.network") {
t.Errorf("holds = %v %d %q", ok, rule, why)
}
o := newOutsideActs(nil, func() {}, func(string, ...any) {}, 0, 0)
o.Heard("mesh.seat.mesh-conditions.event.condition-raised", []byte(`{"key":"machine.ace.network","subject":{"id":"ace","scope":"machine","machine":"ace"}}`))
if !o.Held("ace") || o.Held("g14") {
t.Error("the own network condition's event does not hold the machine")
}
o.Heard("mesh.seat.mesh-conditions.event.condition-cleared", []byte(`{"key":"machine.ace.network","subject":{"id":"ace","scope":"machine","machine":"ace"}}`))
if o.Held("ace") {
t.Error("the machine is held after its condition cleared")
}
}
func TestTheToolsReadAndReleaseAnOutsideWait(t *testing.T) {
r := newOutsideRig(t)
r.cond("machine.hub.unreachable", "ace")
r.review(false, nil)
var acts []string
s := newPutTools(memStore{waitsState: &memKV{values: map[string][]byte{}}, buckets.DeliveryWaitsState: &memKV{values: map[string][]byte{}}, buckets.DeliveredAgainState: &memKV{values: map[string][]byte{}}}, func(key string, body any) (json.RawMessage, error) {
acts = append(acts, key)
return json.RawMessage(`{"ok":true,"log":"logged"}`), nil
})
for k, v := range r.p.w.read(buckets.Waits()) {
s.st.put(waitsState, k, v)
}
got, err := s.doWaits(map[string]any{"module": "nats"})
if err != nil || len(got.(map[string]any)["waits"].([]any)) != 1 {
t.Fatalf("assigner_waits = %+v %v", got, err)
}
if w := got.(map[string]any)["waits"].([]any)[0].(waitSaid); w.On != "unreachable:hub" || w.BoundEnds == "" {
t.Errorf("wait = %+v", w)
}
if _, err := s.doRelease(map[string]any{"node": "ace", "module": "nats", "how": "sideways", "why": "x"}, "shanks.node-tools"); err == nil {
t.Error("an unknown how is taken")
}
if _, err := s.doRelease(map[string]any{"node": "ace", "module": "nats", "how": "go-on"}, "shanks.node-tools"); err == nil || len(acts) != 0 {
t.Error("a release with no why is taken")
}
if _, err := s.doRelease(map[string]any{"node": "ace", "module": "nats", "how": "go-on", "why": "the hub is being rebuilt"}, "shanks.node-tools"); err != nil {
t.Fatal(err)
}
if len(acts) == 0 || !strings.Contains(acts[0], "hand-act") {
t.Errorf("the hand act is not recorded first: %v", acts)
}
keys, _ := s.st.keys(waitsState)
raw, _, _, _ := s.st.get(waitsState, keys[0])
if w, _ := outside.Decode(raw); w.Release != "go-on" || !strings.Contains(w.By, "the hub is being rebuilt") {
t.Errorf("wait = %+v", w)
}
// the process takes the release at its next pass: ended go-on, counted healthy
r.p.w.put(buckets.Waits(), keys[0], raw)
n := r.review(false, nil)
if r.bodies[len(r.bodies)-1].How != "go-on" || n.Haves["ace"]["nats"].Health != nodeengineclient.HealthOK {
t.Errorf("last %+v health %s", r.bodies[len(r.bodies)-1], n.Haves["ace"]["nats"].Health)
}
// A-246: a dependent's delivery wait is listed beside them, and released by its module and step delivery, its hand act first.
dw, _ := json.Marshal(deliveryWaiting{Wait: meshwants.Wait{Step: meshwants.WaitStepDelivery, Module: "app", Part: "db", On: "db@1.1.0", Machines: []string{"g14"}}})
s.st.put(buckets.DeliveryWaitsState, "app", dw)
got, err = s.doWaits(map[string]any{"node": "g14"})
if d := got.(map[string]any)["delivery"].([]deliveryWaiting); err != nil || len(d) != 1 || d[0].Module != "app" {
t.Errorf("the delivery waits listed = %+v %v", got, err)
}
if _, err := s.doRelease(map[string]any{"module": "app", "step": "build", "why": "x"}, "shanks.node-tools"); err == nil {
t.Error("a release of another step is taken")
}
if _, err := s.doRelease(map[string]any{"module": "web", "step": "delivery", "why": "x"}, "shanks.node-tools"); err == nil {
t.Error("a release of a module waiting for no delivery is taken")
}
before := len(acts)
if _, err := s.doRelease(map[string]any{"module": "app", "step": "delivery", "why": "db is fine as it runs"}, "shanks.node-tools"); err != nil {
t.Fatal(err)
}
raw, _, _, _ = s.st.get(buckets.DeliveryWaitsState, "app")
var released deliveryWaiting
if json.Unmarshal(raw, &released) != nil || !released.Released || !strings.Contains(released.By, "db is fine") || len(acts) != before+1 {
t.Errorf("the delivery wait after its release = %+v, hand acts %v", released, acts[before:])
}
// A-250: assigner_delivered_again records its hand act, writes the ask and answers asked; assigner_waits lists it.
if _, err := s.doDeliveredAgain(map[string]any{"module": "db", "version": "1.1.0"}, "op"); err == nil {
t.Error("an ask with no why is taken")
}
ans, err := s.doDeliveredAgain(map[string]any{"module": "db", "version": "1.1.0", "why": "the catalog missed it"}, "op")
if err != nil || ans.(map[string]any)["asked"] != "db" || len(acts) != before+2 {
t.Fatalf("assigner_delivered_again = %+v %v", ans, err)
}
got, _ = s.doWaits(map[string]any{})
if a := got.(map[string]any)["delivered-again"].([]againAsk); len(a) != 1 || a[0].Version != "1.1.0" || a[0].By != "op" {
t.Errorf("the asks listed = %+v", a)
}
}
@@ -0,0 +1,300 @@
package main
import (
"encoding/json"
"errors"
"fmt"
"slices"
"sort"
"strings"
"time"
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/keys"
"mesh-delivery-assigner/internal/acting"
"mesh-delivery-assigner/internal/buckets"
"mesh-delivery-assigner/internal/outside"
)
// The tools of the waits on an outside cause (design 47 G §706, §276's row *delivery on an outside cause*): `assigner_waits` reads
// each, the settle included, and `assigner_release` with `how` takes one. The tool writes the release into the wait's record and the
// assigner's process ends the wait at its next pass, saying wait-ended with that how.
// toolWaits is the tool that reads the outside waits.
const toolWaits = "assigner_waits"
// waitsState is the assigner's state of waits, as the runtime names a module's own state.
const waitsState = buckets.WaitsState
// waitSaid is one wait as assigner_waits answers it: its record and where it stands.
type waitSaid struct {
Key string `json:"key"`
outside.Wait
// Settling's end is in the record; Ends is when the bound runs from clock-from, empty for a settle.
BoundEnds string `json:"bound-ends,omitempty"`
}
// actingSaid is one wait for an acting part's new version as assigner_waits answers it (actingwaits.go).
type actingSaid struct {
Key string `json:"key"`
acting.Wait
BoundEnds string `json:"bound-ends,omitempty"`
}
// doWaits is the tool assigner_waits.
func (s *putTools) doWaits(args map[string]any) (any, error) {
keys, err := s.st.keys(waitsState)
if err != nil {
return nil, fmt.Errorf("the waits cannot be listed: %w", err)
}
sort.Strings(keys)
out := []any{}
for _, key := range keys {
raw, _, found, err := s.st.get(waitsState, key)
if err != nil || !found {
continue
}
if acting.Is(key) || acting.IsOrder(key) {
if a, err := acting.Decode(raw); err == nil && (arg(args, "node") == "" || a.Node == arg(args, "node")) && (arg(args, "module") == "" || a.Module == arg(args, "module")) {
said := actingSaid{Key: key, Wait: a}
if d, err := time.ParseDuration(a.Bound); err == nil && !a.Released {
said.BoundEnds = a.ClockFrom.Add(d).UTC().Format("2006-01-02T15:04:05Z")
}
out = append(out, said)
}
continue
}
w, err := outside.Decode(raw)
if err != nil || (arg(args, "node") != "" && w.Node != arg(args, "node")) || (arg(args, "module") != "" && w.Module != arg(args, "module")) {
continue
}
said := waitSaid{Key: key, Wait: w}
if w.Standing() {
if d, err := time.ParseDuration(w.Bound); err == nil {
said.BoundEnds = w.ClockFrom.Add(d).UTC().Format("2006-01-02T15:04:05Z")
}
}
out = append(out, said)
}
// And each dependent's wait for its dependency's delivery (design 47 G §376, A-246), from the state delivery-waits.
delivery := []deliveryWaiting{}
dkeys, err := s.st.keys(buckets.DeliveryWaitsState)
if err != nil {
return nil, fmt.Errorf("the delivery waits cannot be listed: %w", err)
}
sort.Strings(dkeys)
for _, key := range dkeys {
raw, _, found, err := s.st.get(buckets.DeliveryWaitsState, key)
if err != nil || !found {
continue
}
var w deliveryWaiting
if json.Unmarshal(raw, &w) != nil || (arg(args, "module") != "" && w.Module != arg(args, "module")) ||
(arg(args, "node") != "" && !slices.Contains(w.Machines, arg(args, "node"))) {
continue
}
delivery = append(delivery, w)
}
// And each ask of assigner_delivered_again not yet holding, with why (A-250).
again := []againAsk{}
akeys, err := s.st.keys(buckets.DeliveredAgainState)
if err != nil {
return nil, fmt.Errorf("the asks to say a version delivered again cannot be listed: %w", err)
}
sort.Strings(akeys)
for _, key := range akeys {
raw, _, found, err := s.st.get(buckets.DeliveredAgainState, key)
var a againAsk
if err != nil || !found || json.Unmarshal(raw, &a) != nil || (arg(args, "module") != "" && a.Module != arg(args, "module")) {
continue
}
again = append(again, a)
}
return map[string]any{"waits": out, "delivery": delivery, "delivered-again": again}, nil
}
// toolDeliveredAgain is the tool that asks version-delivered said again for one version (design 47 G §376, A-250).
const toolDeliveredAgain = "assigner_delivered_again"
// doDeliveredAgain is assigner_delivered_again: the hand act is recorded first, then the ask is written into the state
// delivered-again, whose watch the assigner's process hears at once; it answers that it is asked.
func (s *putTools) doDeliveredAgain(args map[string]any, by string) (any, error) {
module, version, why := arg(args, "module"), arg(args, "version"), arg(args, "why")
if module == "" || version == "" || why == "" {
return nil, errors.New("assigner_delivered_again names the module, its version and why: it is kept in the hand-act log")
}
rec := meshhandactsclient.Recorder{Ask: s.ask}
taken, err := rec.Record(meshhandactsclient.Request{What: fmt.Sprintf("assigner_delivered_again %s %s", module, version), Why: why,
Cause: "version-delivered", Verb: "mesh-wants.assigner_delivered_again"})
if err != nil {
return nil, fmt.Errorf("the hand act could not be recorded, so nothing was asked: %w", err)
}
data, err := json.Marshal(againAsk{Module: module, Version: version, By: by, Why: why})
if err != nil {
return nil, err
}
if err := s.st.put(buckets.DeliveredAgainState, keys.EscapeName(module), data); err != nil {
return nil, fmt.Errorf("the ask of %s %s is not written: %w", module, version, err)
}
return map[string]any{"asked": module, "version": version, "hand-act": taken.Log,
"follow": "the assigner says version-delivered again once every present machine placing it runs it healthy; assigner_waits says why it does not yet"}, nil
}
// deliveredAgainTool is assigner_delivered_again as the runtime serves it.
func (s *putTools) deliveredAgainTool() stdio.Tool {
return stdio.Tool{Name: toolDeliveredAgain, Description: "Say version-delivered again for one version of a module, for the operator and the healers " +
"(design 47 G §376): written in the hand-act log first, then asked of the assigner, which says it once every present machine placing " +
"the module runs that version healthy; until then assigner_waits lists the ask with why it does not hold. Answers that it is asked.",
Input: schema(map[string]string{"module": "the module", "version": "its MAJOR.MINOR.PATCH", "why": "why, kept in the hand-act log"},
[]string{"module", "version", "why"}),
Run: func(a map[string]any) (any, error) { return s.doDeliveredAgain(a, stdio.CallerOf(a)) }}
}
// doReleaseDelivery is assigner_release with step delivery: the hand act is recorded first, then the release is written on the
// module's delivery wait, which the assigner's process ends released at its next pass, writing the module's want.
func (s *putTools) doReleaseDelivery(args map[string]any, by string) (any, error) {
module, why := arg(args, "module"), arg(args, "why")
if why == "" {
return nil, errors.New("release says why: it is kept in the hand-act log")
}
key := keys.EscapeName(module)
raw, _, found, err := s.st.get(buckets.DeliveryWaitsState, key)
if err != nil {
return nil, fmt.Errorf("the delivery wait of %s is not read: %w", module, err)
}
var w deliveryWaiting
if !found || json.Unmarshal(raw, &w) != nil || w.Released {
return nil, fmt.Errorf("%s waits for no delivery: assigner_waits lists the delivery waits", module)
}
rec := meshhandactsclient.Recorder{Ask: s.ask}
taken, err := rec.Record(meshhandactsclient.Request{What: fmt.Sprintf("assigner_release %s step delivery (waits on %s)", module, w.On), Why: why,
Cause: "delivery-wait", Verb: "mesh-wants.assigner_release"})
if err != nil {
return nil, fmt.Errorf("the hand act could not be recorded, so nothing was released: %w", err)
}
w.Released, w.By = true, by+": "+why
data, err := json.Marshal(w)
if err != nil {
return nil, err
}
if err := s.st.put(buckets.DeliveryWaitsState, key, data); err != nil {
return nil, fmt.Errorf("the release of %s's delivery wait is not written: %w", module, err)
}
return map[string]any{"released": module, "step": meshwants.WaitStepDelivery, "by": by, "hand-act": taken.Log}, nil
}
// doReleaseWait is assigner_release with how: the hand act is recorded first, then the release is written on the wait of node and
// module, which the assigner's process takes at its next pass.
func (s *putTools) doReleaseWait(args map[string]any, by string) (any, error) {
node, module, how, why := arg(args, "node"), arg(args, "module"), arg(args, "how"), arg(args, "why")
if how == acting.HowNow {
return s.doReleaseActing(node, module, why, by)
}
if !slices.Contains([]string{outside.HowGoOn, outside.HowFailed, outside.HowRejudge}, how) {
return nil, fmt.Errorf("how is %s, %s or %s, not %q", outside.HowGoOn, outside.HowFailed, outside.HowRejudge, how)
}
if why == "" {
return nil, errors.New("release says why: it is kept in the hand-act log")
}
keys, err := s.st.keys(waitsState)
if err != nil {
return nil, fmt.Errorf("the waits cannot be listed: %w", err)
}
prefix := node + "." + module + "."
var key string
var w outside.Wait
for _, k := range keys {
if !strings.HasPrefix(k, prefix) {
continue
}
raw, _, found, err := s.st.get(waitsState, k)
if err != nil || !found {
continue
}
if c, err := outside.Decode(raw); err == nil && c.Decided == "" {
key, w = k, c
}
}
if key == "" {
return nil, fmt.Errorf("%s holds no wait of %s on an outside cause: assigner_waits lists them", node, module)
}
rec := meshhandactsclient.Recorder{Ask: s.ask}
taken, err := rec.Record(meshhandactsclient.Request{What: fmt.Sprintf("assigner_release %s %s %s", node, module, how), Why: why,
Cause: "outside-wait", Verb: "mesh-wants.assigner_release"})
if err != nil {
return nil, fmt.Errorf("the hand act could not be recorded, so nothing was released: %w", err)
}
w.Release, w.By, w.Why = how, by+": "+why, why
data, err := outside.Encode(w)
if err != nil {
return nil, err
}
if err := s.st.put(waitsState, key, data); err != nil {
return nil, fmt.Errorf("the release of %s on %s is not written: %w", module, node, err)
}
return map[string]any{"released": key, "how": how, "by": by, "hand-act": taken.Log}, nil
}
// doReleaseActing is assigner_release with how `now`: the entry of module on node moves with its acting parts' running versions. The
// hand act is recorded first; the release is written on each standing wait of the entry, and the process says wait-ended at its next pass.
func (s *putTools) doReleaseActing(node, module, why, by string) (any, error) {
if why == "" {
return nil, errors.New("release says why: it is kept in the hand-act log")
}
keys, err := s.st.keys(waitsState)
if err != nil {
return nil, fmt.Errorf("the waits cannot be listed: %w", err)
}
type one struct {
key string
w acting.Wait
}
var held []one
prefix, orderPrefix := acting.Prefix+node+"."+module+".", acting.OrderPrefix+node+"."+module+"."
for _, k := range keys {
if !strings.HasPrefix(k, prefix) && !strings.HasPrefix(k, orderPrefix) {
continue
}
raw, _, found, err := s.st.get(waitsState, k)
if err != nil || !found {
continue
}
if w, err := acting.Decode(raw); err == nil && !w.Released {
held = append(held, one{k, w})
}
}
if len(held) == 0 {
return nil, fmt.Errorf("%s holds no wait of %s for an acting part: assigner_waits lists them", node, module)
}
rec := meshhandactsclient.Recorder{Ask: s.ask}
taken, err := rec.Record(meshhandactsclient.Request{What: fmt.Sprintf("assigner_release %s %s %s", node, module, acting.HowNow), Why: why,
Cause: "acting-wait", Verb: "mesh-wants.assigner_release"})
if err != nil {
return nil, fmt.Errorf("the hand act could not be recorded, so nothing was released: %w", err)
}
released := []string{}
for _, h := range held {
h.w.Released, h.w.By, h.w.Why = true, by+": "+why, why
data, err := acting.Encode(h.w)
if err != nil {
return nil, err
}
if err := s.st.put(waitsState, h.key, data); err != nil {
return nil, fmt.Errorf("the release of %s on %s is not written: %w", module, node, err)
}
released = append(released, h.key)
}
return map[string]any{"released": released, "how": acting.HowNow, "by": by, "hand-act": taken.Log}, nil
}
// waitsTool is assigner_waits as the runtime serves it.
func (s *putTools) waitsTool() stdio.Tool {
return stdio.Tool{Name: toolWaits, Description: "Every wait of the delivery and where it stands: an entry waiting for an acting part's new version in composing or placing (§266, §268), with its part, version, step, clock-from and bound; and a moved module's failing health check on a " +
"machine whose open conditions name a cause outside the delivery (design 47 G §706), with its module, machine, fingerprint, the " +
"condition's key, what it stands `on`, its clock-from, bound, its ask and its state; a settle shows as settling with its end. Narrowed by " +
"machine or module. Read-only.",
Input: schema(map[string]string{"node": "one machine", "module": "one module"}, nil), Run: s.doWaits}
}
@@ -0,0 +1,6 @@
package main
import plc "mesh-delivery-assigner/internal/assignment"
// The assigner's tests run as the module its manifest names, as a credential's module would say it at its start (design 47 G A-296).
func init() { plc.SetModule("mesh-delivery-assigner") }
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,539 @@
package main
import (
"context"
"encoding/json"
"errors"
"fmt"
"slices"
"sort"
"strconv"
"strings"
"sync"
"time"
"github.com/nats-io/nats.go/jetstream"
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient"
mdseat "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshdelivery"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/process"
"mesh-delivery-assigner/internal/assign"
"mesh-delivery-assigner/internal/assigngraph"
"mesh-delivery-assigner/internal/assignment"
)
// The pins of the assignment graph revisions (design 47 G §153, §178, §216, §579; A-169): the gate says on the seat
// mesh-delivery which revisions a delivery record starts (`pinned`) and stops (`freed`) pointing at, and once at each of its
// starts `pins-stated`. The assigner hears them on its durable consumer of the events stream and keeps, in its old `state`
// section `pins` (4 MiB), one key `trunk.<n>` per assignment graph revision whose value is the list of the records pinning
// it, added or removed by compare-and-set before the event is acknowledged; a record heard twice pins once. Two more keys:
// `made`, written once when the state is first used, and `pins-stated`, the `at` of the last pins-stated applied. A revision
// is removed, its object and its key and the entry objects no kept revision lists and no want or running build names
// (§179), when its list is empty and it is not current (the newest the assigner wrote), only while the consumer is caught up
// and once a pins-stated said after `made` was applied; judged on a freed, on a revision ceasing to be current, on being
// caught up, and at start once both hold. Never on a timer, and never by reading the gate's state.
const (
pinsState = "pins"
pinsTool = "assigner_pins"
unpinTool = "assigner_unpin"
pinsMadeKey = "made"
pinsStatedKey = "pins-stated"
pinsCapBytes = 4 << 20
pinMissingKind = "pin-missing"
)
// PinsValue is one value of the state pins: the records that pin the revision, and whether the revision was no longer held
// when a record pinned it.
type PinsValue struct {
Records []string `json:"records"`
Missing bool `json:"missing,omitempty"`
}
// pinKey is the key of an assignment graph revision, its object's own name (A-169).
func pinKey(revision int64) string { return assigngraph.TrunkObject(revision) }
// pinRevision is the revision a key of the state names, and whether it names one.
func pinRevision(key string) (int64, bool) {
n, ok := strings.CutPrefix(key, "trunk.")
if !ok {
return 0, false
}
r, err := strconv.ParseInt(n, 10, 64)
return r, err == nil && r > 0
}
// pinObjects is the object bucket of the revisions as the pins remove from it.
type pinObjects interface {
assigngraph.Objects
Delete(ctx context.Context, name string) error
}
// pinKeeper keeps the pins and removes what nothing pins.
type pinKeeper struct {
ctx context.Context
st endStore
objects pinObjects
// inUse says a want or a running build names the module's fingerprint (§179).
inUse func(module, fp string) bool
findings assign.Findings
now func() time.Time
logf func(string, ...any)
mu sync.Mutex
// caught is whether the last event applied left none of the consumer's messages pending.
caught bool
}
// edit applies change to the value at key by compare-and-set, again while another write comes between.
func (k *pinKeeper) edit(key string, change func(v PinsValue, found bool) (PinsValue, bool)) error {
for {
raw, rev, err := k.st.get(key)
if err != nil {
return err
}
var v PinsValue
if raw != nil {
if err := json.Unmarshal(raw, &v); err != nil {
return fmt.Errorf("the pins of %s do not read: %w", key, err)
}
}
next, write := change(v, raw != nil)
if !write {
return nil
}
value, _ := json.Marshal(next)
if err := k.st.swap(key, value, rev); errors.Is(err, errSwapped) {
continue
} else {
return err
}
}
}
// held says the revision's object is kept.
func (k *pinKeeper) held(revision int64) (bool, error) {
_, err := k.objects.Get(k.ctx, assigngraph.TrunkObject(revision))
if errors.Is(err, assigngraph.ErrNoObject) {
return false, nil
}
return err == nil, err
}
// pin adds record to each assignment graph revision of p; a revision no longer held is written missing, with the finding
// pin-missing naming the record.
func (k *pinKeeper) pin(p mdseat.Pins) error {
for _, r := range p.Assignment {
held, err := k.held(r)
if err != nil {
return err
}
err = k.edit(pinKey(r), func(v PinsValue, _ bool) (PinsValue, bool) {
if slices.Contains(v.Records, p.Record) && (held || v.Missing) {
return v, false
}
if !slices.Contains(v.Records, p.Record) {
v.Records = append(v.Records, p.Record)
slices.Sort(v.Records)
}
v.Missing = v.Missing || !held
return v, true
})
if err != nil {
return err
}
if !held {
k.missing(r, p.Record)
}
}
return nil
}
// free removes record from each assignment graph revision of p; a freed applied twice changes nothing.
func (k *pinKeeper) free(p mdseat.Pins) error {
for _, r := range p.Assignment {
err := k.edit(pinKey(r), func(v PinsValue, found bool) (PinsValue, bool) {
i := slices.Index(v.Records, p.Record)
if !found || i < 0 {
return v, false
}
v.Records = slices.Delete(v.Records, i, i+1)
return v, true
})
if err != nil {
return err
}
}
return nil
}
// missing writes the finding pin-missing, scope the assigner, id the revision.
func (k *pinKeeper) missing(revision int64, record string) {
if k.findings.Put == nil {
k.logf("the revision %d the record %s pins is not held, and no finding writer is wired to say so", revision, record)
return
}
o := assign.Observed{Scope: assignment.Module(), ID: strconv.FormatInt(revision, 10), Kind: pinMissingKind,
Summary: fmt.Sprintf("the delivery record %s pins the assignment graph revision %d, which the assigner no longer holds", record, revision),
Headline: "A delivery record pins a revision the assigner no longer holds",
Explanation: fmt.Sprintf("The record %s pinned revision %d after it was removed; %s clears it.", record, revision, unpinTool),
Source: assignment.Module()}
if err := k.findings.Put(o.Finding(k.now())); err != nil {
k.logf("the finding %s of revision %d is not written: %v", pinMissingKind, revision, err)
}
}
// made writes the key made once, create-only; one there already stays.
func (k *pinKeeper) made() error {
raw, _, err := k.st.get(pinsMadeKey)
if err != nil || raw != nil {
return err
}
value, _ := json.Marshal(k.now().UTC())
if err := k.st.swap(pinsMadeKey, value, 0); err != nil && !errors.Is(err, errSwapped) {
return err
}
return nil
}
// timeAt is the time a key holds; false when it holds none.
func (k *pinKeeper) timeAt(key string) (time.Time, bool, error) {
raw, _, err := k.st.get(key)
if err != nil || raw == nil {
return time.Time{}, false, err
}
var t time.Time
if err := json.Unmarshal(raw, &t); err != nil {
return t, false, fmt.Errorf("the key %s does not read: %w", key, err)
}
return t, true, nil
}
// stated keeps the at of a pins-stated applied.
func (k *pinKeeper) stated(at time.Time) error {
for {
raw, rev, err := k.st.get(pinsStatedKey)
if err != nil {
return err
}
var was time.Time
if raw != nil && json.Unmarshal(raw, &was) == nil && !at.After(was) {
return nil
}
value, _ := json.Marshal(at.UTC())
if err := k.st.swap(pinsStatedKey, value, rev); errors.Is(err, errSwapped) {
continue
} else {
return err
}
}
}
// statedSinceMade says a pins-stated said after the state was made was applied.
func (k *pinKeeper) statedSinceMade() (bool, error) {
made, ok, err := k.timeAt(pinsMadeKey)
if err != nil || !ok {
return false, err
}
at, ok, err := k.timeAt(pinsStatedKey)
if err != nil || !ok {
return false, err
}
return at.After(made), nil
}
// hear applies one of the seat mesh-delivery's events and acknowledges it only once applied.
func (k *pinKeeper) hear(m jetstream.Msg) {
err := k.apply(m.Subject(), m.Data())
if err != nil {
k.logf("%s: %v; it is heard again", m.Subject(), err)
_ = m.Nak()
return
}
_ = m.Ack()
caught := false
if meta, merr := m.Metadata(); merr == nil {
caught = meta.NumPending == 0
}
k.mu.Lock()
was := k.caught
k.caught = caught
k.mu.Unlock()
if caught && (!was || m.Subject() != mdseat.SubjectPinned) {
k.judge() // on a freed, on a candidate's heads replaced, on pins-stated, and on being caught up
}
}
// apply takes one event's body.
func (k *pinKeeper) apply(subject string, data []byte) error {
switch subject {
case mdseat.SubjectPinned, mdseat.SubjectFreed:
var p mdseat.Pins
if err := json.Unmarshal(data, &p); err != nil || p.Record == "" {
k.logf("%s holds no pins naming a record, and is not taken: %v", subject, err)
return nil
}
if subject == mdseat.SubjectPinned {
return k.pin(p)
}
return k.free(p)
case mdseat.SubjectPinsStated:
var s mdseat.PinsStatedEvent
if err := json.Unmarshal(data, &s); err != nil || s.At.IsZero() {
k.logf("%s holds no at, and is not taken: %v", subject, err)
return nil
}
return k.stated(s.At)
}
return nil // heads-replaced: a candidate's revision stops being current, judged after
}
// judge removes every revision neither pinned nor current, when the rule allows a removal at all.
func (k *pinKeeper) judge() {
k.mu.Lock()
caught := k.caught
k.mu.Unlock()
if !caught {
return
}
ok, err := k.statedSinceMade()
if err != nil {
k.logf("the pins are not judged: %v", err)
return
}
if !ok {
return // no pins-stated applied since the state was made: a pin said before may not be heard yet
}
if err := k.remove(); err != nil {
k.logf("the revisions nothing pins are not removed: %v", err)
}
}
// remove removes each kept revision that is not current and that no record pins, and then the entries left unlisted.
func (k *pinKeeper) remove() error {
names, err := k.objects.Names(k.ctx)
if err != nil {
return err
}
var kept []int64
for _, n := range names {
if r, ok := pinRevision(n); ok {
kept = append(kept, r)
}
}
if len(kept) == 0 {
return nil
}
current := slices.Max(kept)
listed := map[string]bool{}
removed := 0
for _, r := range kept {
raw, _, err := k.st.get(pinKey(r))
if err != nil {
return err
}
var v PinsValue
if raw != nil {
if err := json.Unmarshal(raw, &v); err != nil {
return fmt.Errorf("the pins of %d do not read: %w", r, err)
}
}
if r == current || len(v.Records) > 0 {
rev, err := assigngraph.ReadRevision(k.ctx, k.objects, r)
if err != nil {
return err
}
for _, e := range rev.Entries {
listed[e.Digest] = true
}
continue
}
if err := k.objects.Delete(k.ctx, assigngraph.TrunkObject(r)); err != nil {
return fmt.Errorf("revision %d: %w", r, err)
}
if raw != nil {
if err := k.st.drop(pinKey(r)); err != nil {
return fmt.Errorf("the pins of %d: %w", r, err)
}
}
removed++
}
if removed == 0 {
return nil
}
// A run's candidate kept now lists its entries too, until its group-ended drops it (A-201, A-235).
for _, n := range names {
group, heads, ok := meshwants.ParseAssignmentRevisionsByCandidateGroupHeadsKey(n)
if !ok {
continue
}
rev, err := assigngraph.ReadCandidate(k.ctx, k.objects, group, heads)
if err != nil {
return err
}
for _, e := range rev.Entries {
listed[e.Digest] = true
}
}
for _, n := range names {
digest, ok := strings.CutPrefix(n, "entry.")
if !ok || listed[digest] {
continue
}
e, err := assigngraph.ReadEntry(k.ctx, k.objects, digest)
if err != nil {
return err
}
if k.inUse != nil && k.inUse(e.Module, e.Fp) {
continue
}
if err := k.objects.Delete(k.ctx, n); err != nil {
return fmt.Errorf("the entry %s: %w", digest, err)
}
}
k.logf("%d assignment graph revisions no record pins and not current are removed", removed)
return nil
}
// hearPins registers the seat mesh-delivery's four events on the assigner's hub.
func hearPins(hub *process.EventHub, k *pinKeeper) error {
for _, s := range []string{mdseat.SubjectPinned, mdseat.SubjectFreed, mdseat.SubjectHeadsReplaced, mdseat.SubjectPinsStated} {
if err := hub.Handle(s, k.hear); err != nil {
return fmt.Errorf("%s: %w", s, err)
}
}
return nil
}
// pinsTools are assigner_pins and assigner_unpin over the runtime's states.
func pinsTools(st store, ask func(string, any) (json.RawMessage, error)) []stdio.Tool {
return []stdio.Tool{{Name: pinsTool, Description: "the assignment graph revisions the delivery records pin (design 47 G §579): per revision " +
"the records that pin it and whether it was missing when pinned, the newest revision kept (current, never removed), when the state " +
"was made, the last pins-stated applied, and the state's fill against its cap of 4 MiB.",
Run: func(map[string]any) (any, error) { return readPins(st) }},
{Name: unpinTool, Description: "Remove one record from a revision's pins, for a freed that was lost (design 47 G §579); written in the " +
"hand-act log first. The removal rule then applies.",
Input: schema(map[string]string{"revision": "the assignment graph revision's number", "record": "the delivery record's id",
"why": "why it is removed by hand"}, []string{"revision", "record", "why"}),
Run: func(a map[string]any) (any, error) {
record, _ := a["record"].(string)
why, _ := a["why"].(string)
return unpin(st, ask, fmt.Sprint(a["revision"]), record, why, stdio.CallerOf(a))
}}}
}
// readPins is what assigner_pins answers.
func readPins(st store) (any, error) {
ks, err := st.keys(pinsState)
if err != nil {
return nil, err
}
sort.Strings(ks)
revisions := map[string]PinsValue{}
out := map[string]any{"revisions": revisions}
var newest int64
bytes := 0
for _, key := range ks {
raw, _, found, err := st.get(pinsState, key)
if err != nil || !found {
continue
}
bytes += len(key) + len(raw)
if r, ok := pinRevision(key); ok {
var v PinsValue
if json.Unmarshal(raw, &v) == nil {
revisions[key] = v
}
newest = max(newest, r)
continue
}
out[key] = json.RawMessage(raw)
}
out["fill"] = meshwants.Fill{Store: pinsState, Bytes: int64(bytes), Cap: pinsCapBytes}
if newest > 0 {
out["newest-pinned"] = newest
}
return out, nil
}
// unpin removes one record from one revision's list, the hand act recorded first.
func unpin(st store, ask func(string, any) (json.RawMessage, error), revision, record, why, by string) (any, error) {
r, err := strconv.ParseInt(strings.TrimPrefix(revision, "trunk."), 10, 64)
switch {
case err != nil || r <= 0:
return nil, fmt.Errorf("revision %q is no assignment graph revision's number", revision)
case record == "" || why == "":
return nil, errors.New("name the record and say why")
case by == "" || by == stdio.Unproven:
return nil, errors.New("an unpin names who asks it, and the runtime proved no caller")
}
key := pinKey(r)
raw, _, found, err := st.get(pinsState, key)
if err != nil {
return nil, err
}
var v PinsValue
if found {
if err := json.Unmarshal(raw, &v); err != nil {
return nil, err
}
}
i := slices.Index(v.Records, record)
if i < 0 {
return nil, fmt.Errorf("the record %s does not pin revision %d: %s lists its pins", record, r, pinsTool)
}
taken, err := meshhandactsclient.Recorder{Ask: ask}.Record(meshhandactsclient.Request{What: unpinTool + " " + key + " " + record,
Why: why + " (" + by + ")", Cause: "unpin"})
if err != nil {
return nil, fmt.Errorf("the hand act is not recorded, so nothing is removed: %w", err)
}
v.Records = slices.Delete(v.Records, i, i+1)
value, _ := json.Marshal(v)
if err := st.put(pinsState, key, value); err != nil {
return nil, err
}
return map[string]any{"revision": r, "unpinned": record, "records": v.Records, "hand-act": taken.Log}, nil
}
// watchUnpins judges again when a revision's pins change in the state itself, as assigner_unpin writes them from the tool
// process: the assigner's own state, heard as it changes, never on a timer.
func (k *pinKeeper) watchUnpins(kv jetstream.KeyValue) {
w, err := kv.WatchAll(k.ctx, jetstream.UpdatesOnly())
if err != nil {
k.logf("the state %s is not watched, so a hand unpin is judged at the next freed or revision: %v", pinsState, err)
return
}
go func() {
defer func() { _ = w.Stop() }()
for e := range w.Updates() {
if e == nil {
continue
}
if _, ok := pinRevision(e.Key()); ok && e.Operation() == jetstream.KeyValuePut {
k.judge()
}
}
}()
}
// inUseOf says a want or a running build names the module's fingerprint, as the world holds them now.
func inUseOf(w *world) func(module, fp string) bool {
return func(module, fp string) bool {
for _, want := range w.wantsOf()[module] {
if want.Fp == fp {
return true
}
}
for _, mods := range w.runningNow() {
if r, ok := mods[module]; ok && r.Fingerprint == fp {
return true
}
}
return false
}
}
func pinsBucket() string { return assignment.Module() + "_" + pinsState }
@@ -0,0 +1,119 @@
package main
import (
"context"
"encoding/json"
"testing"
"time"
mcseat "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions"
mdseat "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshdelivery"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
"mesh-delivery-assigner/internal/assign"
"mesh-delivery-assigner/internal/assigngraph"
)
func (m memObjects) Delete(_ context.Context, name string) error { delete(m, name); return nil }
// The pins of the assignment graph revisions (design 47 G §153, §178, §579; A-169): a revision two records pin stays until
// both free it; a record pinning twice pins once; the current revision is never removed; nothing is removed before a
// pins-stated said after the state was made, nor while the consumer is behind; a revision no longer held is pinned missing,
// with the finding pin-missing; an entry another kept revision lists, or a want or a running build names, stays.
func TestPinsKeepARevisionWhileARecordPinsIt(t *testing.T) {
objects := memObjects{}
entry := func(module, fp string) string {
e := meshwants.AssignmentEntry{Node: "n1", Module: module, Fp: fp}
d := assigngraph.EntryDigest(e)
raw, _ := json.Marshal(e)
objects[assigngraph.EntryObject(d)] = raw
return d
}
shared, old, running := entry("a", "fp-a"), entry("b", "fp-b1"), entry("c", "fp-c1")
revision := func(n int64, digests ...string) {
rev := meshwants.AssignmentRevision{Revision: n}
for _, d := range digests {
rev.Entries = append(rev.Entries, meshwants.NodeEntryRef{Node: "n1", Digest: d})
}
raw, _ := json.Marshal(rev)
objects[assigngraph.TrunkObject(n)] = raw
}
// A run's candidate lists an entry no trunk revision lists (A-201): it stays while the candidate is kept.
cand := entry("d", "fp-d2")
candRaw, _ := json.Marshal(meshwants.AssignmentRevision{Revision: 1, Kind: "candidate", Group: "run-7", Heads: "h1",
Entries: []meshwants.NodeEntryRef{{Node: "n1", Module: "d", Digest: cand}}})
objects[assigngraph.CandidateObject("run-7", "h1")] = candRaw
revision(1, shared, old, running)
revision(2, shared, old)
revision(3, shared)
var found []mcseat.Finding
clock := time.Date(2026, 11, 12, 10, 0, 0, 0, time.UTC)
k := &pinKeeper{ctx: context.Background(), st: newMemEnds(), objects: objects, now: func() time.Time { return clock },
logf: t.Logf,
inUse: func(module, fp string) bool { return module == "c" && fp == "fp-c1" },
findings: assign.Findings{Put: func(f mcseat.Finding) error { found = append(found, f); return nil }}}
if err := k.made(); err != nil {
t.Fatal(err)
}
say := func(subject string, body any) {
t.Helper()
raw, _ := json.Marshal(body)
if err := k.apply(subject, raw); err != nil {
t.Fatal(err)
}
k.judge()
}
pins := func(record string, revs ...int64) mdseat.Pins { return mdseat.Pins{Record: record, Assignment: revs} }
has := func(n int64) bool { _, ok := objects[assigngraph.TrunkObject(n)]; return ok }
k.caught = true
say(mdseat.SubjectPinned, pins("r1", 1))
say(mdseat.SubjectPinned, pins("r1", 1))
say(mdseat.SubjectPinned, pins("r2", 1))
say(mdseat.SubjectFreed, pins("r9", 2)) // nothing pins 2, but no pins-stated since made: nothing removed
if !has(2) {
t.Fatal("revision 2 was removed before a pins-stated said after the state was made")
}
k.caught = false
say(mdseat.SubjectPinsStated, mdseat.PinsStatedEvent{At: clock.Add(time.Minute)})
if !has(2) {
t.Fatal("revision 2 was removed while the consumer was behind")
}
k.caught = true
say(mdseat.SubjectFreed, pins("r1", 1))
if has(2) {
t.Error("revision 2, neither pinned nor current, is kept")
}
if !has(1) || !has(3) {
t.Error("revision 1 (pinned by r2) or 3 (current) was removed")
}
raw, _, _ := k.st.get(pinKey(1))
if string(raw) != `{"records":["r2"]}` {
t.Errorf("the pins of 1 = %s, want r2 alone (r1 pinned twice pins once, and freed once)", raw)
}
say(mdseat.SubjectFreed, pins("r2", 1))
if has(1) {
t.Error("revision 1 is kept once both records freed it")
}
if _, ok := objects[assigngraph.EntryObject(old)]; ok {
t.Error("the entry no kept revision lists and nothing names is kept")
}
if _, ok := objects[assigngraph.EntryObject(running)]; !ok {
t.Error("the entry of a running build is removed")
}
if _, ok := objects[assigngraph.EntryObject(shared)]; !ok {
t.Error("the entry the current revision lists is removed")
}
if _, ok := objects[assigngraph.EntryObject(cand)]; !ok {
t.Error("the entry a run's kept candidate lists is removed")
}
say(mdseat.SubjectHeadsReplaced, mdseat.HeadsReplacedEvent{})
if _, ok := objects[assigngraph.CandidateObject("run-7", "h1")]; !ok {
t.Error("the gate's heads-replaced dropped a run's candidate")
}
say(mdseat.SubjectPinned, pins("r3", 2))
raw, _, _ = k.st.get(pinKey(2))
if string(raw) != `{"records":["r3"],"missing":true}` || len(found) != 1 || found[0].Kind != pinMissingKind || found[0].ID != "2" {
t.Errorf("a pin of a revision no longer held = %s, findings %+v", raw, found)
}
}
@@ -0,0 +1,504 @@
package main
import (
"context"
"encoding/json"
"errors"
"fmt"
"slices"
"sort"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/nats-io/nats.go/jetstream"
mcc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
mprc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshpipelinerunnerclient"
mwc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshwantsclient"
mpcat "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
mpr "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner"
stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/keys"
"git.novox.be/novox/mesh-sdk/go/process"
)
// The wants follow a passed pipeline (design 47 G §29, §35, §325, §352): the runner says each pipeline's end as
// pipeline-ended, and a group's as group-ended. The assigner keeps, in its old state `written`, one key per module and
// watched branch: the source revision and end count of the newest end it heard for it, and whether the wants were written
// from it. A newer end replaces it by compare-and-set; an older one, or the same one again, writes nothing.
// writtenState is the assigner's state of the pipeline ends its wants follow; writtenTool reads it.
const (
writtenState = "written"
writtenTool = "assigner_written"
)
// pipelineEndedSubject and groupEndedSubject are the runner's events the assigner consumes.
const (
pipelineEndedSubject = "mesh.seat." + mpr.Seat + ".event." + mpr.EventPipelineEnded + ".>"
groupEndedSubject = "mesh.seat." + mpr.Seat + ".event." + mpr.EventGroupEnded + ".>"
)
// End is one value of the state written: the newest end of a module's pipeline on a watched branch.
type End struct {
Source int64 `json:"source"`
EndCount int64 `json:"end-count"`
Fp string `json:"fp"`
Commit string `json:"commit,omitempty"`
// Passed: the pipeline ended passed, every required step passed (and, for a group, the group ended passed).
Passed bool `json:"passed"`
// Written: the wants were written from this end.
Written bool `json:"written,omitempty"`
Why string `json:"why,omitempty"`
}
// endKey is the key of a module on a watched branch, each name escaped as a key's name is.
func endKey(module, branch string) string {
return keys.EscapeName(module) + "." + keys.EscapeName(branch)
}
// newer says whether an end of (source, count) replaces the one kept: a later source revision, or the same one ended again.
func (e End) newer(source, count int64) bool {
return source > e.Source || (source == e.Source && count > e.EndCount)
}
// requiredPassed says whether no required step of a pipeline stands failed, unasked or unended (design 47 G §30: a failed
// optional step holds nothing).
func requiredPassed(p mpr.PipelineEnded) bool {
for _, s := range p.Steps {
if s.Status != mpr.StepResultStatusRequired {
continue
}
switch s.Outcome {
case mpr.StepResultOutcomeFailed, mpr.StepResultOutcomeCouldNotRun, mpr.StepResultOutcomeDeclined, mpr.StepResultOutcomeNotAsked,
mpr.StepResultOutcomeCancelled, mpr.StepResultOutcomeSuperseded, mpr.StepResultOutcomeDidNotBuild,
mpr.StepResultOutcomeRunning, mpr.StepResultOutcomeWaiting, mpr.StepResultOutcomeWaitingForABuildNode:
return false
}
}
return p.Outcome == mpr.PipelineEndedOutcomePassed
}
// endStore is the kept state written: the bus bucket, or a test's.
type endStore interface {
// get is a key's value and revision; none for a key not there.
get(key string) (value []byte, revision uint64, err error)
// swap writes value at key if the key stands at revision (0: if it does not stand); errSwapped when it does not.
swap(key string, value []byte, revision uint64) error
// keys are the keys that stand, and drop deletes one.
keys() ([]string, error)
drop(key string) error
}
var errSwapped = errors.New("the key changed")
// kvEnds is endStore over a bus bucket.
type kvEnds struct {
ctx context.Context
kv jetstream.KeyValue
}
func (k kvEnds) get(key string) ([]byte, uint64, error) {
e, err := k.kv.Get(k.ctx, key)
if errors.Is(err, jetstream.ErrKeyNotFound) {
return nil, 0, nil
}
if err != nil {
return nil, 0, err
}
return e.Value(), e.Revision(), nil
}
func (k kvEnds) swap(key string, value []byte, revision uint64) error {
var err error
if revision == 0 {
_, err = k.kv.Create(k.ctx, key, value)
} else {
_, err = k.kv.Update(k.ctx, key, value, revision)
}
if errors.Is(err, jetstream.ErrKeyExists) || (err != nil && isWrongSequence(err)) {
return errSwapped
}
return err
}
func (k kvEnds) keys() ([]string, error) {
ks, err := k.kv.Keys(k.ctx)
if errors.Is(err, jetstream.ErrNoKeysFound) {
return nil, nil
}
return ks, err
}
func (k kvEnds) drop(key string) error { return k.kv.Delete(k.ctx, key) }
func isWrongSequence(err error) bool {
var ae *jetstream.APIError
return errors.As(err, &ae) && ae.ErrorCode == jetstream.JSErrCodeStreamWrongLastSequence
}
// pipelineEnds follows the runner's ends. A nil *pipelineEnds is the trunk-only want, kept until the first registrations
// (design 47 G §95, §353).
type pipelineEnds struct {
st endStore
wake func()
logf func(string, ...any)
// on is whether the wants follow the ends: set by the first registration heard, never before (design 47 G §95, §353).
on atomic.Bool
mu sync.Mutex
// firsts is, by module, the first watched branch of its registration, the branch of a placement that names none (design
// 47 G §14).
firsts map[string]string
// runEnded is told a run on request's group-ended, its group `run-<id>`, to drop the run's candidate (A-235); nil drops nothing.
runEnded func(group string) error
// left is told the key of a pipeline ended superseded or cancelled, whose composition steps leave the runs they read
// (design 47 G §723, A-469n); none tells nothing. Set once the composition steps are served, after the hub starts.
left atomic.Pointer[func(pipeline string) error]
// onBranches is told the branches a registration names, for the catalog half of each to be followed (design 47 G §14, §195).
onBranches func([]string)
// trunk names the first watched branch, the trunk's (design 47 G §507), the branch of a module registered with none.
trunk func() string
// runner is the module holding the seat mesh-pipeline-runner, as the last pass read it from the acting edges (A-334); nil
// until a pass read the graph.
runner atomic.Pointer[string]
// held are the group members' pipeline-ended heard before a pass read the graph, by their body: unacknowledged, so the
// bus keeps them, and taken once the runner is read (A-334), never dropped for the runner not being known yet.
held map[string]jetstream.Msg
}
// setRunner keeps the module holding the seat mesh-pipeline-runner, read by the pass from the acting edges (A-334); the
// first one takes the group members' ends held until the graph was read.
func (e *pipelineEnds) setRunner(module string) {
e.mu.Lock()
first := e.runner.Swap(&module) == nil
held := e.held
e.held = nil
e.mu.Unlock()
if !first {
return
}
for _, m := range held {
e.hearPipeline(m)
}
}
// holdUntilRead keeps m, a group member's pipeline-ended, until a pass reads the runner from the graph; false when the
// runner is read already, so m is taken now.
func (e *pipelineEnds) holdUntilRead(m jetstream.Msg) bool {
e.mu.Lock()
defer e.mu.Unlock()
if e.runner.Load() != nil {
return false
}
if e.held == nil {
e.held = map[string]jetstream.Msg{}
}
e.held[string(m.Data())] = m
e.logf("%s is a group member's end heard before the assignment graph is read: held until a pass reads which module is the runner (A-334)", m.Subject())
return true
}
// isRunner says whether module holds the seat mesh-pipeline-runner, as the last pass read it.
func (e *pipelineEnds) isRunner(module string) bool {
r := e.runner.Load()
return r != nil && *r != "" && *r == module
}
func newPipelineEnds(st endStore, wake func(), logf func(string, ...any)) *pipelineEnds {
return &pipelineEnds{st: st, wake: wake, logf: logf, firsts: map[string]string{}}
}
// take keeps one pipeline's end if it is newer than the one kept for its module and branch, by compare-and-set.
func (e *pipelineEnds) take(p mpr.PipelineEnded, passed bool) error {
key := endKey(p.Module, p.Branch)
for {
raw, rev, err := e.st.get(key)
if err != nil {
return err
}
if raw != nil {
var kept End
if err := json.Unmarshal(raw, &kept); err == nil && !kept.newer(p.Source, p.EndCount) {
return nil // an older end, or this one again
}
}
end := End{Source: p.Source, EndCount: p.EndCount, Fp: p.Fingerprint, Commit: p.Commit, Passed: passed, Why: p.Why}
value, err := json.Marshal(end)
if err != nil {
return err
}
if err := e.st.swap(key, value, rev); errors.Is(err, errSwapped) {
continue
} else if err != nil {
return err
}
e.wake()
return nil
}
}
// markWritten says the wants of module on branch were written from the end it keeps, if that is still the end of fp.
func (e *pipelineEnds) markWritten(module, branch, fp string) {
key := endKey(module, branch)
for {
raw, rev, err := e.st.get(key)
var kept End
if err != nil || raw == nil || json.Unmarshal(raw, &kept) != nil || kept.Fp != fp || kept.Written {
return
}
kept.Written = true
value, _ := json.Marshal(kept)
if err := e.st.swap(key, value, rev); errors.Is(err, errSwapped) {
continue
} else if err != nil {
e.logf("the end of %s on %s is not marked written: %v", module, branch, err)
}
return
}
}
// passedAt says whether the newest end kept for module on branch passed at fp.
func (e *pipelineEnds) passedAt(module, branch, fp string) bool {
raw, _, err := e.st.get(endKey(module, branch))
var kept End
return err == nil && raw != nil && json.Unmarshal(raw, &kept) == nil && kept.Passed && kept.Fp == fp
}
// branchOf is the watched branch a placement names, else the first of the module's registration, else the trunk's.
func (e *pipelineEnds) branchOf(module, placed string) string {
if placed != "" {
return placed
}
e.mu.Lock()
defer e.mu.Unlock()
if b := e.firsts[module]; b != "" {
return b
}
if e.trunk != nil {
return e.trunk()
}
return ""
}
// hearPipeline takes a pipeline-ended. A pipeline of a group writes nothing on its own end, but the runner's: in a group
// take-in that changes the runner it is the acting part the other members wait on, so it goes first, wanted on its own end
// once that passed, ahead of the group (A-334, as the node-engine does, §268). A run on request delivers nothing (design 47 G
// §29, §64).
func (e *pipelineEnds) hearPipeline(m jetstream.Msg) {
p, err := mprc.PipelineEnded(m.Data())
if left := e.left.Load(); err == nil && left != nil && (p.Outcome == mpr.PipelineEndedOutcomeSuperseded || p.Outcome == mpr.PipelineEndedOutcomeCancelled) {
if err := (*left)(p.Pipeline); err != nil {
e.logf("%s: the composition steps of %s do not all leave their runs: %v; it is heard again", m.Subject(), p.Pipeline, err)
_ = m.Nak()
return
}
}
switch {
case err != nil:
e.logf("%s is not taken: %v", m.Subject(), err)
case p.Run == "" && p.Group != "" && e.holdUntilRead(m):
return
case p.Run != "" || (p.Group != "" && !e.isRunner(p.Module)):
default:
if err := e.take(p, requiredPassed(p)); err != nil {
e.logf("%s: %v; it is heard again", m.Subject(), err)
_ = m.Nak()
return
}
}
_ = m.Ack()
}
// hearGroup takes a group-ended: each member's end, passed only if the group passed. A run on request's (group `run-<id>`) delivers
// nothing: it drops the run's candidate assignment graph (A-235).
func (e *pipelineEnds) hearGroup(m jetstream.Msg) {
g, err := mprc.GroupEnded(m.Data())
if err != nil {
e.logf("%s is not taken: %v", m.Subject(), err)
_ = m.Ack()
return
}
if strings.HasPrefix(g.Group, runGroupPrefix) {
if e.runEnded != nil {
if err := e.runEnded(g.Group); err != nil {
e.logf("%s: %v; it is heard again", m.Subject(), err)
_ = m.Nak()
return
}
}
_ = m.Ack()
return
}
for _, p := range g.Pipelines {
if err := e.take(p, g.Outcome == mpr.GroupEndedOutcomePassed && requiredPassed(p)); err != nil {
e.logf("%s: %v; it is heard again", m.Subject(), err)
_ = m.Nak()
return
}
}
_ = m.Ack()
}
// hearEnds registers the two events on the assigner's hub.
func hearEnds(hub *process.EventHub, e *pipelineEnds) error {
if err := hub.Handle(pipelineEndedSubject, e.hearPipeline); err != nil {
return fmt.Errorf("%s: %w", pipelineEndedSubject, err)
}
if err := hub.Handle(groupEndedSubject, e.hearGroup); err != nil {
return fmt.Errorf("%s: %w", groupEndedSubject, err)
}
return nil
}
// writtenTools is the tool assigner_written: every key of the state written, with its end.
func writtenTools(st store) []stdio.Tool {
return []stdio.Tool{{Name: writtenTool, Description: "the pipeline ends the assigner's wants follow: per module and watched branch, the source revision and end count of the newest end heard, whether it passed and whether the wants were written from it; with why, why each want is what it is (as assigner_why).",
Input: schema(map[string]string{"why": "true: why each want is what it is", "module": "with why: a module's name", "node": "with why: a node's name"}, nil, "why"),
Run: func(args map[string]any) (any, error) {
if args["why"] == true || args["why"] == "true" {
return whyTools(st)[0].Run(args) // a want's why (why.go), until the manifest naming assigner_why is taken in
}
ks, err := st.keys(writtenState)
if err != nil {
return nil, err
}
sort.Strings(ks)
out := map[string]End{}
for _, k := range ks {
if strings.HasPrefix(k, whyPrefix) {
continue // a want's why (why.go), read by assigner_why
}
raw, _, ok, err := st.get(writtenState, k)
if err != nil || !ok {
continue
}
var e End
if json.Unmarshal(raw, &e) == nil {
out[k] = e
}
}
return out, nil
}}}
}
// branchesOf is the watched branches the placements of module chose, each once; the default branch when none names one.
func (e *pipelineEnds) branchesOf(module string, placed map[string]map[string]string) []string {
if !e.following() {
return nil
}
seen := map[string]bool{}
var out []string
for _, b := range placed[module] {
b = e.branchOf(module, b)
if !seen[b] {
seen[b] = true
out = append(out, b)
}
}
if len(out) == 0 {
out = append(out, e.branchOf(module, ""))
}
sort.Strings(out)
return out
}
// mayWant says whether module's wants may name fp: a pipeline passed at fp on every branch, or the wants name fp already
// (a node placed later, a module taken away).
func (e *pipelineEnds) mayWant(module, fp string, branches []string, wanted map[string]mwc.Want) bool {
if !e.following() {
return true
}
for _, w := range wanted {
if w.Fp == fp {
return true
}
}
for _, b := range branches {
if !e.passedAt(module, b, fp) {
return false
}
}
return true
}
// wrote marks the end the wants of module were written from.
func (e *pipelineEnds) wrote(module, fp string, branches []string) {
if !e.following() {
return
}
for _, b := range branches {
e.markWritten(module, b, fp)
}
}
// following says whether the wants follow the pipeline ends yet; a nil follower never does.
func (e *pipelineEnds) following() bool { return e != nil && e.on.Load() }
// registered takes a module's registration (design 47 G §353): the first one heard switches the wants to the ends, its first
// watched branch is the default a placement runs, and the ends kept for a branch it no longer watches are deleted (§352). gone
// is a registration removed: all its ends go.
func (e *pipelineEnds) registered(reg mpcat.Registration, gone bool) {
e.mu.Lock()
if gone || len(reg.Branches) == 0 {
delete(e.firsts, reg.Module)
} else {
e.firsts[reg.Module] = reg.Branches[0]
}
e.mu.Unlock()
kept, err := e.st.keys()
if err != nil {
e.logf("the ends kept cannot be listed: %v", err)
}
prefix := keys.EscapeName(reg.Module) + "."
for _, k := range kept {
rest, ok := strings.CutPrefix(k, prefix)
if !ok {
continue
}
branch, err := keys.UnescapeName(rest)
if err == nil && !gone && slices.Contains(reg.Branches, branch) {
continue
}
if err := e.st.drop(k); err != nil {
e.logf("the end %s is not deleted: %v", k, err)
}
}
if e.onBranches != nil && !gone {
e.onBranches(reg.Branches)
}
if !e.on.Swap(true) {
e.logf("the first registration is heard (%s): the wants follow the pipelines' ends from now", reg.Module)
}
e.wake()
}
// followRegistrations follows the registrations through the seat mesh-catalog (design 47 G §353): a first view of its verb
// and each registration-changed on the hub. It returns when the hub's handler is registered; the first view is asked on its own
// goroutine, the wants keep the trunk-only form until a registration is heard.
func followRegistrations(ctx context.Context, hub *process.EventHub, call mcc.Call, e *pipelineEnds) error {
regs := mcc.NewRegistrations(call)
regs.Follower.Logf = e.logf
regs.Follower.Changed = func(module string, value json.RawMessage, gone bool, _ time.Time) {
reg := mpcat.Registration{Module: module}
if !gone {
_ = json.Unmarshal(value, &reg)
}
e.registered(reg, gone)
}
if err := hub.Handle(mpcat.SubjectRegistrationChanged, func(m jetstream.Msg) {
if err := regs.Hear(ctx, m.Data()); err != nil {
e.logf("%s: %v", m.Subject(), err)
}
_ = m.Ack()
}); err != nil {
return err
}
go func() {
if err := regs.Start(ctx); err != nil && ctx.Err() == nil {
e.logf("the first view of the registrations is not answered: %v", err)
}
}()
return nil
}
@@ -0,0 +1,450 @@
package main
import (
"context"
"encoding/json"
"fmt"
mmac "git.novox.be/novox/mesh-contracts/go/clients/meshmoduleassignerclient"
mma "git.novox.be/novox/mesh-contracts/go/seats/meshmoduleassigner"
plc "mesh-delivery-assigner/internal/assignment"
"slices"
"strings"
"testing"
"time"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
mwc "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshwantsclient"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
mpcat "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
mpr "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner"
oc "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/seats/operatorchannel"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"github.com/nats-io/nats.go/jetstream"
"git.novox.be/novox/mesh-delivery/modules/mesh-grants/grantsstate"
"git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
"git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
"mesh-delivery-assigner/internal/assigngraph"
"mesh-delivery-assigner/internal/buckets"
mws "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
)
// memEnds is endStore over a map, with revisions.
type memEnds struct {
vals map[string][]byte
revs map[string]uint64
}
func newMemEnds() *memEnds { return &memEnds{vals: map[string][]byte{}, revs: map[string]uint64{}} }
func (m *memEnds) get(key string) ([]byte, uint64, error) { return m.vals[key], m.revs[key], nil }
func (m *memEnds) keys() (out []string, _ error) {
for k := range m.vals {
out = append(out, k)
}
return out, nil
}
func (m *memEnds) drop(key string) error { delete(m.vals, key); delete(m.revs, key); return nil }
func (m *memEnds) swap(key string, v []byte, rev uint64) error {
if m.revs[key] != rev {
return errSwapped
}
m.vals[key], m.revs[key] = v, rev+1
return nil
}
// heardMsg is one message as a handler of the hub is handed it, saying whether it was acknowledged or given back.
type heardMsg struct {
jetstream.Msg
data []byte
subject string
acked, naked bool
}
func (m *heardMsg) Data() []byte { return m.data }
func (m *heardMsg) Subject() string { return m.subject }
func (m *heardMsg) Ack() error { m.acked = true; return nil }
func (m *heardMsg) Nak() error { m.naked = true; return nil }
func pipe(module, branch string, source, count int64, fp, outcome string, steps ...mpr.StepResult) mpr.PipelineEnded {
return mpr.PipelineEnded{Module: module, Branch: branch, Source: source, EndCount: count, Fingerprint: fp, Outcome: outcome, Steps: steps,
Pipeline: branch + "." + module, Commit: "c"}
}
func step(status, outcome string) mpr.StepResult {
return mpr.StepResult{Step: "unit", Status: status, Outcome: outcome}
}
// Design 47 G §29, §35, §325, §352 (tests 66, 67, 89): a want follows a passed pipeline, by compare-and-set per module and branch.
func TestAWantFollowsAPassedPipeline(t *testing.T) {
const fp1, fp2 = "fp1", "fp2"
pass, fail := mpr.PipelineEndedOutcomePassed, mpr.PipelineEndedOutcomeFailed
req, opt := mpr.StepResultStatusRequired, mpr.StepResultStatusOptional
for _, c := range []struct {
name string
ends []mpr.PipelineEnded
group *mpr.GroupEnded
module string
branch string
fp string
may bool
}{
{"a failed required step writes no want", []mpr.PipelineEnded{pipe("web", "main", 5, 1, fp1, fail, step(req, "failed"))}, nil, "web", "main", fp1, false},
{"a pipeline passed writes", []mpr.PipelineEnded{pipe("web", "main", 5, 1, fp1, pass, step(req, "passed"))}, nil, "web", "main", fp1, true},
{"a failed optional step holds nothing", []mpr.PipelineEnded{pipe("web", "main", 5, 1, fp1, pass, step(req, "passed"), step(opt, "failed"))}, nil, "web", "main", fp1, true},
{"a pipeline passed at another fingerprint", []mpr.PipelineEnded{pipe("web", "main", 5, 1, fp1, pass)}, nil, "web", "main", fp2, false},
{"an older revision ending after a newer one writes nothing", []mpr.PipelineEnded{pipe("web", "main", 6, 1, fp2, fail), pipe("web", "main", 5, 1, fp1, pass)}, nil, "web", "main", fp1, false},
{"another branch writes its own", []mpr.PipelineEnded{pipe("web", "main", 6, 1, fp2, fail), pipe("web", "beta", 5, 1, fp1, pass)}, nil, "web", "beta", fp1, true},
{"a later end of the same revision writes", []mpr.PipelineEnded{pipe("web", "main", 5, 1, fp1, fail, step(req, "failed")), pipe("web", "main", 5, 2, fp1, pass, step(req, "passed"))}, nil, "web", "main", fp1, true},
{"the same end again after a later one keeps the later", []mpr.PipelineEnded{pipe("web", "main", 5, 2, fp1, pass), pipe("web", "main", 5, 1, fp1, fail)}, nil, "web", "main", fp1, true},
{"a member's own end writes nothing", []mpr.PipelineEnded{func() mpr.PipelineEnded { p := pipe("web", "main", 5, 1, fp1, pass); p.Group = "g"; return p }()}, nil, "web", "main", fp1, false},
{"a group ended passed writes its members", nil, &mpr.GroupEnded{Branch: "main", Group: "g", Outcome: mpr.GroupEndedOutcomePassed, Pipelines: []mpr.PipelineEnded{pipe("web", "main", 5, 1, fp1, pass)}}, "web", "main", fp1, true},
{"a group ended failed writes none", nil, &mpr.GroupEnded{Branch: "main", Group: "g", Outcome: mpr.GroupEndedOutcomeFailed, Pipelines: []mpr.PipelineEnded{pipe("web", "main", 5, 1, fp1, pass)}}, "web", "main", fp1, false},
} {
woken := 0
e := newPipelineEnds(newMemEnds(), func() { woken++ }, t.Logf)
e.on.Store(true)
for _, p := range c.ends {
if p.Group != "" {
continue // heard and ignored, as hearPipeline does
}
if err := e.take(p, requiredPassed(p)); err != nil {
t.Fatal(err)
}
}
if g := c.group; g != nil {
for _, p := range g.Pipelines {
if err := e.take(p, g.Outcome == mpr.GroupEndedOutcomePassed && requiredPassed(p)); err != nil {
t.Fatal(err)
}
}
}
if got := e.mayWant(c.module, c.fp, []string{c.branch}, nil); got != c.may {
t.Errorf("%s: may want = %v, want %v", c.name, got, c.may)
}
}
// A run on request's group-ended (group run-<id>, A-235) writes no want and drops the run's candidate; a drop that fails is
// heard again.
{
e := newPipelineEnds(newMemEnds(), func() {}, t.Logf)
e.on.Store(true)
var dropped []string
fail := false
e.runEnded = func(group string) error {
dropped = append(dropped, group)
if fail {
return fmt.Errorf("the bucket is not open")
}
return nil
}
raw, _ := json.Marshal(mpr.GroupEnded{V: 1, Branch: "main", Group: "run-7", Outcome: mpr.GroupEndedOutcomePassed,
Pipelines: []mpr.PipelineEnded{func() mpr.PipelineEnded { p := pipe("web", "main", 5, 1, fp1, pass); p.Run = "7"; return p }()}})
m := &heardMsg{data: raw, subject: "mesh.seat.mesh-pipeline-runner.event.group-ended.x"}
e.hearGroup(m)
if e.mayWant("web", fp1, []string{"main"}, nil) || !slices.Equal(dropped, []string{"run-7"}) || !m.acked {
t.Errorf("a run's group-ended: may want %v, dropped %v, acked %v; want no want, run-7 dropped, acked",
e.mayWant("web", fp1, []string{"main"}, nil), dropped, m.acked)
}
fail = true
m = &heardMsg{data: raw, subject: m.subject}
e.hearGroup(m)
if !m.naked {
t.Error("a run's candidate not dropped is not heard again")
}
}
// A-334 (§29, §65, §268): in a group take-in that changes the runner, the runner's member (the holder of the seat
// mesh-pipeline-runner, read from the acting edges) is wanted on its own pipeline-ended once it passed, ahead of the group;
// the other members wait for group-ended.
{
e := newPipelineEnds(newMemEnds(), func() {}, t.Logf)
e.on.Store(true)
heard := func(p mpr.PipelineEnded) *heardMsg {
p.Group = "g"
raw, _ := json.Marshal(p)
m := &heardMsg{data: raw, subject: "mesh.seat.mesh-pipeline-runner.event.pipeline-ended.x"}
e.hearPipeline(m)
return m
}
hear := func(p mpr.PipelineEnded) {
if m := heard(p); !m.acked {
t.Errorf("the pipeline-ended of %s is not acknowledged", p.Module)
}
}
// The runner's end heard before a pass read the graph is held, unacknowledged, and taken once the runner is read.
early := heard(pipe("runner", "main", 5, 1, "fp-runner", pass, step(req, "passed")))
if early.acked || early.naked || e.mayWant("runner", "fp-runner", []string{"main"}, nil) {
t.Fatalf("the runner's end before the graph is read: acked %v, naked %v, wanted %v; want it held", early.acked, early.naked,
e.mayWant("runner", "fp-runner", []string{"main"}, nil))
}
e.setRunner(assigngraph.Runner([]mws.AssignmentEntry{{Node: "ace", Module: "web", Edges: []mws.Edge{
{Kind: assigngraph.EdgeActing, Node: "ace", Module: "runner", Seat: mpr.Seat, Step: "pipeline"}}}}))
if !early.acked {
t.Error("the runner's end held until the graph was read is not taken once it is")
}
hear(pipe("web", "main", 5, 1, fp1, pass, step(req, "passed")))
if !e.mayWant("runner", "fp-runner", []string{"main"}, nil) || e.mayWant("web", fp1, []string{"main"}, nil) {
t.Errorf("a group changing the runner: may want the runner %v, web %v; want the runner ahead of the group and web not yet",
e.mayWant("runner", "fp-runner", []string{"main"}, nil), e.mayWant("web", fp1, []string{"main"}, nil))
}
hear(pipe("runner", "main", 6, 1, "fp-runner-2", fail, step(req, "failed")))
if e.mayWant("runner", "fp-runner-2", []string{"main"}, nil) {
t.Error("the runner's member that failed is wanted")
}
}
// Design 47 G A-428: the runner's first start skips the gate while no module claiming the seat runs; another module never
// does, and a runner running anywhere (stopped ones aside) closes it; with no running heard the gate stands.
manifests := map[string]catalogue.Manifest{"runner": {Claims: []catalogue.Claim{{Name: mpr.Seat}}}, "web": {}}
none := map[string]map[string]nodeengine.Running{"ace": {"web": {Fingerprint: fp1}}}
if !runnerFirstStart("runner", manifests, none) || runnerFirstStart("web", manifests, none) || runnerFirstStart("runner", manifests, nil) {
t.Error("the runner's first start: the runner skips the gate, another module or an unknown world does not")
}
if runnerFirstStart("runner", manifests, map[string]map[string]nodeengine.Running{"novox": {"runner": {Fingerprint: "fp-runner"}}}) ||
!runnerFirstStart("runner", manifests, map[string]map[string]nodeengine.Running{"novox": {"runner": {Stopped: true}}}) {
t.Error("a runner running closes the gate's opening; one stopped does not")
}
// A want that names the fingerprint already is not held by a later failure (a node placed afterwards gets it).
e := newPipelineEnds(newMemEnds(), func() {}, t.Logf)
e.on.Store(true)
if !e.mayWant("web", fp1, []string{"main"}, map[string]mwc.Want{"g14": {Fp: fp1}}) {
t.Error("a want naming the fingerprint was held")
}
// markWritten keeps the end and says it was written from; a newer end replaces it unwritten.
st := newMemEnds()
e = newPipelineEnds(st, func() {}, t.Logf)
e.on.Store(true)
_ = e.take(pipe("web", "main", 5, 1, fp1, pass), true)
e.wrote("web", fp1, []string{"main"})
var end End
_ = json.Unmarshal(st.vals[endKey("web", "main")], &end)
if !end.Written || end.Source != 5 {
t.Errorf("end = %+v, want written at source 5", end)
}
_ = e.take(pipe("web", "main", 6, 1, fp2, pass), true)
end = End{}
_ = json.Unmarshal(st.vals[endKey("web", "main")], &end)
if end.Written || end.Source != 6 {
t.Errorf("a newer end = %+v, want unwritten at source 6", end)
}
}
// Design 47 G §29: the wants of a pass follow a pipeline: with the follower on, a module whose fingerprint no pipeline passed at
// gets no want and one a pipeline passed at gets it; with it off (nil, the trunk-only want) the pass is as before.
func TestAPassWritesNoWantWithoutAPassedPipeline(t *testing.T) {
fp := meshcatalogclient.SourcePrefix2 + strings.Repeat("a", 64)
for _, c := range []struct {
name string
follow bool
passed bool
want bool
}{{"the trunk-only want", false, false, true}, {"no pipeline passed", true, false, false}, {"a pipeline passed", true, true, true}} {
wantsKV := &memKV{values: map[string][]byte{}}
p := newPasser(kvSet{buckets.Wants(): wantsKV, buckets.Asks(): &memKV{values: map[string][]byte{}}}, time.Now())
p.say = func(oc.Condition) error { return nil }
mdigest := strings.Repeat("e", 64)
mod, _ := meshcatalogclient.EncodeModule(meshcatalog.ModulesByModuleValue{Fp2: fp, Manifest: mdigest, Repository: "novox/web", Commit: strings.Repeat("1", 40), Path: meshcatalogclient.RootPath})
putModuleRaw(p.w, trunkBranch, "web", mod)
p.w.manifests[mdigest] = parsed{module: "web", manifest: catalogue.Manifest{Module: "web"}}
endDone(t, p.w, "web", fp, mdigest)
gkey, _ := grantsstate.PartGrantKey("web", fp)
grant, _ := grantsstate.EncodeGrant(grantsstate.Grant{})
p.w.put(buckets.Grants, gkey, grant)
digest := "sha256:" + strings.Repeat("c", 64)
have, _ := nodeengineclient.EncodeHave(nodeengine.HaveByNodeModuleValue{Fp: fp, Composed: digest, Phase: nodeengineclient.PhaseRunning, Health: nodeengineclient.HealthOK})
p.w.put(buckets.Have, "g14.web", have)
composes(t, p.w, "g14", digest)
placeOn(t, p.w, "g14", "web")
on := true
p.w.heardPresence("g14", !on, time.Now())
if c.follow {
p.ends = newPipelineEnds(newMemEnds(), func() {}, t.Logf)
p.ends.trunk = p.w.trunkName
p.ends.on.Store(true)
if c.passed {
_ = p.ends.take(pipe("web", trunkBranch, 5, 1, fp, mpr.PipelineEndedOutcomePassed), true)
}
}
p.wants(context.Background())
key, _ := mwc.WantKey("g14", "web")
if _, got := wantsKV.values[key]; got != c.want {
t.Errorf("%s: a want written = %v, want %v", c.name, got, c.want)
}
if c.follow && c.passed {
raw, _, _ := p.ends.st.get(endKey("web", trunkBranch))
var end End
_ = json.Unmarshal(raw, &end)
if !end.Written {
t.Errorf("%s: the end was not marked written", c.name)
}
}
}
}
// Design 47 G §95, §130, §353, §352 (test 100): the wants keep the trunk-only form until the first registration is heard and
// switch on it; a branch a registration no longer watches loses its end, and its first branch is a placement's default.
func TestTheWantsSwitchOnTheFirstRegistration(t *testing.T) {
st := newMemEnds()
woken := 0
e := newPipelineEnds(st, func() { woken++ }, t.Logf)
e.trunk = func() string { return trunkBranch }
_ = e.take(pipe("web", "main", 5, 1, "fp1", mpr.PipelineEndedOutcomeFailed), false)
_ = e.take(pipe("web", "beta", 5, 1, "fp1", mpr.PipelineEndedOutcomePassed), true)
if e.following() || !e.mayWant("web", "fp1", []string{"main"}, nil) {
t.Fatal("the follower held a want before any registration")
}
e.registered(mpcat.Registration{Module: "web", Branches: []string{"beta"}}, false)
if !e.following() || woken == 0 {
t.Error("the first registration did not switch the wants on")
}
if e.mayWant("web", "fp1", []string{"main"}, nil) || !e.mayWant("web", "fp1", []string{"beta"}, nil) {
t.Error("after the switch the wants did not follow the ends")
}
if len(st.vals) != 1 || e.branchOf("web", "") != "beta" || e.branchOf("other", "") != trunkBranch {
t.Errorf("ends kept %d, default branch %q: an unwatched branch's end stayed, or the default is wrong", len(st.vals), e.branchOf("web", ""))
}
e.registered(mpcat.Registration{Module: "web"}, true)
if len(st.vals) != 0 {
t.Errorf("a registration gone left %d ends", len(st.vals))
}
}
// Design 47 G §14, §184 (test 68): a node's entry is computed from the catalog half of the branch its placement names, so a
// change on `beta` moves only the want of the node whose placement chose `beta`.
func TestACommitOnBetaMovesOnlyTheNodeThatChoseBeta(t *testing.T) {
fp := func(c string) string { return meshcatalogclient.SourcePrefix2 + strings.Repeat(c, 64) }
wantsKV := &memKV{values: map[string][]byte{}}
p := newPasser(kvSet{buckets.Wants(): wantsKV, buckets.Asks(): &memKV{values: map[string][]byte{}}}, time.Now())
p.say = func(oc.Condition) error { return nil }
p.ends = newPipelineEnds(newMemEnds(), func() {}, t.Logf)
p.ends.trunk = p.w.trunkName
p.ends.registered(mpcat.Registration{Module: "web", Branches: []string{"main", "beta"}}, false)
digest := "sha256:" + strings.Repeat("c", 64)
on := true
for _, node := range []string{"g14", "ace"} {
composes(t, p.w, node, digest)
p.w.heardPresence(node, !on, time.Now())
}
for node, branch := range map[string]string{"g14": "", "ace": "beta"} {
pl := mma.Assignments{Node: node, Modules: []mma.PlacedModule{{Module: "web", Branch: branch}}}
values, err := mmac.AssignmentsValues(pl)
if err != nil {
t.Fatal(err)
}
for key, raw := range values {
p.w.put(plc.AssignmentsBucket(), key, raw)
}
}
// publish makes the half of branch name web at fingerprint f: built, granted and passed by its pipeline.
publish := func(branch, f string, source int64) {
mdigest := strings.Repeat("e", 62) + fmt.Sprintf("%02d", source)
if branch == "beta" {
mdigest = strings.Repeat("f", 62) + fmt.Sprintf("%02d", source)
}
mod, _ := meshcatalogclient.EncodeModule(meshcatalog.ModulesByModuleValue{Fp2: f, Manifest: mdigest, Repository: "novox/web", Commit: strings.Repeat("1", 40), Path: meshcatalogclient.RootPath})
putModuleRaw(p.w, branch, "web", mod)
p.w.manifests[mdigest] = parsed{module: "web", manifest: catalogue.Manifest{Module: "web"}}
endDone(t, p.w, "web", f, mdigest)
gkey, _ := grantsstate.PartGrantKey("web", f)
grant, _ := grantsstate.EncodeGrant(grantsstate.Grant{})
p.w.put(buckets.Grants, gkey, grant)
_ = p.ends.take(pipe("web", branch, source, 1, f, mpr.PipelineEndedOutcomePassed), true)
}
run := func(node, f string) {
have, _ := nodeengineclient.EncodeHave(nodeengine.HaveByNodeModuleValue{Fp: f, Composed: digest, Phase: nodeengineclient.PhaseRunning, Health: nodeengineclient.HealthOK})
p.w.put(buckets.Have, node+".web", have)
}
fpWant := func(node string) string {
key, _ := mwc.WantKey(node, "web")
w, err := mwc.DecodeWant(wantsKV.values[key])
if err != nil {
t.Fatalf("the want of web on %s: %v", node, err)
}
return w.Fp
}
publish("main", fp("a"), 5)
publish("beta", fp("b"), 5)
run("g14", fp("a"))
run("ace", fp("b"))
p.wants(context.Background())
if fpWant("g14") != fp("a") || fpWant("ace") != fp("b") {
t.Fatalf("each node is wanted at its branch's build: g14 %s, ace %s", fpWant("g14"), fpWant("ace"))
}
publish("beta", fp("d"), 6)
p.wants(context.Background())
if fpWant("g14") != fp("a") || fpWant("ace") != fp("d") {
t.Errorf("a commit on beta moves only ace: g14 %s (want main's), ace %s (want beta's new)", fpWant("g14"), fpWant("ace"))
}
}
// Design 47 G §14, §195: the catalog half of each branch is taken into the world per branch, an entry as the value and graph node
// the rules read, and a registration's branches are each followed.
func TestTheCatalogHalfIsTakenInPerBranch(t *testing.T) {
w := newWorld()
woken := 0
h := &halves{w: w, wake: func() { woken++ }, logf: t.Logf}
entry := func(fp string) json.RawMessage {
raw, _ := json.Marshal(meshcatalog.CatalogEntry{Module: "web", Fp: fp, Repository: "novox/web", Commit: "c1",
Manifest: map[string]any{"module": "web", "version": "1", "requires": []any{"database", map[string]any{"name": "cache", "optional": true}}},
Invokes: []string{"seat:x.v"}, Requires: []string{"cache", "database"}})
return raw
}
h.changed("main", "web", entry("src2:1"), false)
h.changed("beta", "web", entry("src2:2"), false)
if w.trunkOf("main")["web"].Fp2 != "src2:1" || w.trunkOf("beta")["web"].Fp2 != "src2:2" || woken != 2 {
t.Errorf("main %+v, beta %+v, woken %d: each branch keeps its own entry", w.trunkOf("main")["web"], w.trunkOf("beta")["web"], woken)
}
v := w.trunkOf("beta")["web"]
if got := w.manifest(v.Manifest); got.err != "" || got.manifest.Module != "web" {
t.Errorf("the entry's manifest is not read by its digest: %+v", got)
}
// The entry's requires name the optional cache too; the graph node means those required, not optionally (A-229).
if n := w.graphOf("main")["web"]; n.FP != "src2:1" || !slices.Equal(n.Invokes, []string{"seat:x.v"}) || !slices.Equal(n.Requires, []string{"database"}) {
t.Errorf("graph node %+v", n)
}
h.changed("beta", "web", nil, true)
if _, ok := w.trunkOf("beta")["web"]; ok || w.trunkOf("main")["web"].Fp2 == "" {
t.Error("a module taken out of beta's half leaves main's")
}
}
// Design 47 G §379, §526: a want held at an older build, the trunk's newer fingerprint having passed no pipeline, is rewritten
// with that build's released version (and parts for an engine that reads them), the rest of the want kept; no want names the
// unpassed fingerprint (novox 2026-11-16, mesh-hand-acts 0.1.13 at 4eb3cf48).
func TestAWantHeldAtAnOlderBuildNamesItsReleaseWithoutAPassedPipeline(t *testing.T) {
old := meshcatalogclient.SourcePrefix2 + strings.Repeat("4", 64)
fp := meshcatalogclient.SourcePrefix2 + strings.Repeat("9", 64)
wantsKV := &memKV{values: map[string][]byte{}}
p := newPasser(kvSet{buckets.Wants(): wantsKV, buckets.Asks(): &memKV{values: map[string][]byte{}}}, time.Now())
p.say = func(oc.Condition) error { return nil }
mdigest := strings.Repeat("e", 64)
mod, _ := meshcatalogclient.EncodeModule(meshcatalog.ModulesByModuleValue{Fp2: fp, Manifest: mdigest, Repository: "novox/web", Commit: strings.Repeat("1", 40), Path: meshcatalogclient.RootPath})
putModuleRaw(p.w, trunkBranch, "web", mod)
p.w.manifests[mdigest] = parsed{module: "web", manifest: catalogue.Manifest{Module: "web"}}
endRaw, _ := json.Marshal(builds.BuildEnded{Module: "web", Fingerprint: old, Outcome: builds.BuildDone, Manifest: mdigest, Made: map[string]string{"tools": "sha256:1c"}})
if err := p.w.ends.put(endRaw); err != nil {
t.Fatal(err)
}
rel, _ := json.Marshal(meshcatalog.VersionReleasedEvent{Module: "web", Source: 962, Version: "0.1.13", Artifacts: []meshcatalog.VersionArtifact{{Artifact: "tools", Digest: "sha256:1c"}}})
if err := p.w.released.put(rel); err != nil {
t.Fatal(err)
}
placeOn(t, p.w, "g14", "web")
key, _ := mwc.WantKey("g14", "web")
held, _ := mwc.EncodeWant(mwc.Want{Fp: old, Self: true})
wantsKV.values[key] = held
p.w.put(buckets.Wants(), key, held)
p.w.heardPresence("g14", false, time.Now())
p.ends = newPipelineEnds(newMemEnds(), func() {}, t.Logf)
p.ends.trunk = p.w.trunkName
p.ends.on.Store(true)
p.wants(context.Background())
got, err := mwc.DecodeWant(wantsKV.values[key])
if err != nil || got.Fp != old || got.Version != "0.1.13" || !got.Self {
t.Errorf("the held want = %+v, %v; want %s at 0.1.13, self kept", got, err, old)
}
}

Some files were not shown because too many files have changed in this diff Show More