diff --git a/CONFORMANCE.md b/CONFORMANCE.md index 6f2272a..e008eb4 100644 --- a/CONFORMANCE.md +++ b/CONFORMANCE.md @@ -56,13 +56,43 @@ Tests that bind an ID from the Janus invariant registry (`jfa-conformance-suite. - **Covenant trust gate not yet wired.** Covenant and economy are built on main and bound to registry tests (see above). The one open half is the covenant's "gates whether": no spend path yet consults a member's standing before admitting a trade on trust. "Never how much" is enforced; "whether" is a named gap, not a claim. - **Record domain-tag rename** (product naming) is pending and must land **before any durable persistence** — retagging after durable logs exist would be a rewrite. - **Named record residuals** (steganographic floor, timestamp covert channel, witness amnesia, liveness gap) are documented in the record package doc rather than pretended away. -- **Contributor node — Executor seam built; runtime implementations pending.** `internal/contribute` fixes the node-contribution contract (Executor / ServiceExecutor / Registry / NodeContract) with two invariants enforced by tests: a scavenged node accepts only preemptible executors (owner-never-interrupted), and a Service workload requires pinned placement. `cmd/cloudy-agent` runs it end to end with a **real** Storage executor (opaque sealed shards + the `internal/storage` proof-of-possession) and **placeholder** Compute/Service executors. The **agent → coordinator loop is built** (`cmd/cloudy-agent/loop.go`, run with `-coordinator`): it lists the node, heartbeats, polls, runs accepted work through the seam, and reports or declines every assignment exactly once, all signed with the node's ed25519 key (`-node-key`, created mode 0600); assignments are verified against the coordinator's key (`-coordinator-key`) and a forged one is declined, never run; opt-out is enforced locally (SPEC §5.1); a scavenged node re-lists as offering nothing when its owner returns. Per [decision 0001](docs/decisions/0001-node-connects-through-its-frontend.md) the agent talks to its frontend: **the node relay is built** (`internal/noderelay`, served on cloudyd's `/v0` routes with `-orchestrator`). Each agent request carries a node request signature (fresh, never replayed, bound to the node the call names); only enrolled nodes are relayed; every node message is verified and forwarded unchanged under the frontend's operator credential, so its signature still verifies at the orchestrator; heartbeats reach the orchestrator at most once a minute per node and polls at most once every 30 seconds; node keys are enrolled with the orchestrator through the operator (SoHoLINK `POST /nodes/pubkey`). The direct SPIFFE route stays available. **Named gaps:** SoHoLINK still creates a node's record only through its participant claim flow, which ties the node to a person at the orchestrator — decision 0001 needs an operator-scoped node registration there (SoHoLINK follow-up); cloudyd's enrolled nodes come from a file (`-nodes`) and live in memory, a stand-in for member-driven enrollment; with the roll-up, the orchestrator's view of a node can lag by up to one roll-up window. Storage has no opt-in flag in the pinned protocol (v0.1.0), so storage work is accepted or declined locally only. The heavy runtime port from the coordinator's transitional `internal/agent` — Docker executor, gopsutil hardware sampling, opt-out/allowlist/printers — lands *behind* the executor seam without changing the loop. +- **Contributor node — Executor seam built; runtime implementations pending.** `internal/contribute` fixes the node-contribution contract (Executor / ServiceExecutor / Registry / NodeContract) with two invariants enforced by tests: a scavenged node accepts only preemptible executors (owner-never-interrupted), and a Service workload requires pinned placement. `cmd/cloudy-agent` runs it end to end with a **real** Storage executor (opaque sealed shards + the `internal/storage` proof-of-possession) and **placeholder** Compute/Service executors. The **agent → coordinator loop is built** (`cmd/cloudy-agent/loop.go`, run with `-coordinator`): it lists the node, heartbeats, polls, runs accepted work through the seam, and reports or declines every assignment exactly once, all signed with the node's ed25519 key (`-node-key`, created mode 0600); assignments are verified against the coordinator's key (`-coordinator-key`) and a forged one is declined, never run; opt-out is enforced locally (SPEC §5.1); a scavenged node re-lists as offering nothing when its owner returns. Per [decision 0001](docs/decisions/0001-node-connects-through-its-frontend.md) the agent talks to its frontend: **the node relay is built** (`internal/noderelay`, served on cloudyd's `/v0` routes with `-orchestrator`). Each agent request carries a node request signature (fresh, never replayed, bound to the node the call names); only enrolled nodes are relayed; every node message is verified and forwarded unchanged under the frontend's operator credential, so its signature still verifies at the orchestrator; heartbeats reach the orchestrator at most once a minute per node and polls at most once every 30 seconds; node keys are enrolled with the orchestrator through the operator (SoHoLINK `POST /nodes/pubkey`). The direct SPIFFE route stays available. **Named gaps:** SoHoLINK still creates a node's record only through its participant claim flow, which ties the node to a person at the orchestrator — decision 0001 needs an operator-scoped node registration there (SoHoLINK follow-up); cloudyd's enrolled nodes come from a file (`-nodes`) and live in memory, a stand-in for member-driven enrollment; with the roll-up, the orchestrator's view of a node can lag by up to one roll-up window. The proposed protocol v0.4.0 dependency includes storage message definitions; this dependency update does not add storage execution or opt-in behavior to the agent. The heavy runtime port from the coordinator's transitional `internal/agent` — Docker executor, gopsutil hardware sampling, opt-out/allowlist/printers — lands *behind* the executor seam without changing the loop. - **Operator enrollment driver — built and live-verified.** `internal/enroll` + `cmd/cloudy-enroll` drive a coordinator's operator onboarding lifecycle end to end (apply → register the 7-key set → email verification → conformance suites A/B → automatic activation), reusing `internal/opcred` for key custody and for computing conformance answers through the real protocol canon. Suite C is graded coordinator-side and needs no operator response, so there is no suite-C step. The client is deliberately separate from `internal/coord`: enrollment is plain JSON on the coordinator's **portal** surface, not the `/v0` node-side wire. The out-of-band email code is supplied via an injected `CodeSource`. Verified against a live SoHoLINK coordinator — the enrolled operator reached `active` and its credential then authenticated on `/v0`. ## Dependency declaration Consumes `sohocloud-protocol` at a published version tag — nothing else from the stack. The member layers reference sealed exchanges by opaque leaf ID, by value, never by importing record types into other layers; conversion happens only at the composition root. +## Proposed protocol response migration + +The dependency draft targets sohocloud-protocol **v0.4.0**, pending publication +and clean tagged-module verification. Both `internal/coord.Dial` and +`DialAsOperator` inherit SPEC §7.1 complete-document response decoding. +`TestCoordinatorResponseFraming` exercises both constructors: JSON whitespace +remains valid, while a second value in jobs or fee responses fails. +The local success-body byte budget remains zero (unbounded); this migration +chooses no deployment-wide limit. The response-limit patch preserves current protocol-main signing bytes; +this upgrade does not preserve v0.1.0 wire compatibility. A temporary external Go workspace validates the protocol +candidate locally; it is not a published-version verification or a committed +replacement dependency. After v0.4.0 publication, regenerate module checksums +and rerun the full build, vet, race suite, and Qlty gate without that workspace. + +### Mixed-version release gate + +These consumers currently pin **v0.1.0**, not v0.3.0. Intervening protocol +releases added GPUs, committed storage, and storage opt-in to listing canonical +bytes and GPU requirements to assignment canonical bytes under their existing +`v0` domains. Even empty new fields change signatures. Old/new peers cannot be +assumed to exchange valid listings or assignments; signed-fee round trips alone +do not prove upgrade safety. + +Before deployment, agree and test a coordinated agent, frontend/relay, and +coordinator upgrade. Do not silently reinterpret stored signatures or adopt a +migration policy in this dependency PR. The protocol migration fixture records +valid v0.1.0 signatures that the candidate rejects; current candidate regression +suites exercise peers using the same version. A mixed-version deployment remains +blocked until its migration procedure is agreed and verified. + ## Product-specific notes (last, per the ordering rule) Cloudy ships as a standalone consumer product (its own member API and app surfaces, in review). SoHoLINK is the reference coordinator it speaks to; any conformant coordinator may replace it. diff --git a/cmd/cloudy-agent/loop.go b/cmd/cloudy-agent/loop.go index 9cba0b4..89220e9 100644 --- a/cmd/cloudy-agent/loop.go +++ b/cmd/cloudy-agent/loop.go @@ -93,14 +93,14 @@ func capsKey(ks []contribute.WorkloadKind) string { func (l *Loop) List(ctx context.Context) error { caps := l.Agent.Capabilities() var opt listing.WorkloadOptIn + // Storage opt-in is not wired into this agent's advertisement; storage work + // is still accepted or declined locally. for _, k := range caps { switch k { case contribute.Compute: opt.Compute = true case contribute.Print: opt.Print = true - // Storage has no opt-in flag in the pinned protocol (v0.1.0): - // the node accepts or declines storage work locally either way. } } cl := listing.CapabilityListing{ diff --git a/go.mod b/go.mod index bb5a9c3..2632e80 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/NTARI-RAND/Cloudy go 1.22 -require github.com/NTARI-RAND/sohocloud-protocol v0.1.0 +require github.com/NTARI-RAND/sohocloud-protocol v0.4.0 diff --git a/internal/coord/response_framing_test.go b/internal/coord/response_framing_test.go new file mode 100644 index 0000000..cdb8e15 --- /dev/null +++ b/internal/coord/response_framing_test.go @@ -0,0 +1,34 @@ +package coord + +import ( + "context" + "net/http" + "net/http/httptest" + "testing" +) + +// Reverting the protocol pin would silently accept an extra response value. +func TestCoordinatorResponseFraming(t *testing.T) { + for _, operator := range []bool{false, true} { + for _, suffix := range []string{" \t\r\n", " {}"} { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + body := "[]" + if r.URL.Path == "/v0/fees" { + body = "{}" + } + _, _ = w.Write([]byte(body + suffix)) + })) + client := Dial(server.URL) + if operator { + client = DialAsOperator(server.URL, func(*http.Request) error { return nil }) + } + _, jobsError := client.PollJobs(context.Background(), "node") + _, feesError := client.Fees(context.Background()) + server.Close() + wantError := suffix == " {}" + if (jobsError != nil) != wantError || (feesError != nil) != wantError { + t.Fatalf("operator=%v suffix=%q jobs=%v fees=%v", operator, suffix, jobsError, feesError) + } + } + } +}