Solution
Reference solution for Hello Pico Nervous System (MQTT).
Reference solution
A working solution consists of the shipped artifacts under downloads/, unchanged, running through the local verifier:
envelope.schema.json— the provider-neutral message envelope covering the seven envelope kinds; per-kind conditional requirements (commandneedstarget+authorization;delegationalso needsdelegation+correlation_id;resultneeds bothcorrelation_idandcausation_id;eventneedssubject) are expressed with JSON-SchemaallOf/if/then.picos.yaml— the Pico registry naming three Picos (pico.architect.001,pico.detective.017,pico.garden.042) by stable identity, with transport identifiers (MQTTclient_id, Kubernetespod) that are deliberately different from the Pico identity.discovery.yaml— the local snapshot of what a live broker’s discovery view would advertise.messages/01-presence.jsonthroughmessages/07-result.json— one sample message per envelope kind, forming one complete delegation → result pair and one complete observation → event → command chain.mqtt-topics.yaml— the topic patterns for each envelope kind (presence,discovery,observation,event,command,delegation,result) and the note that publishing to a topic is not authorization.emqx-adapter.yaml— the EMQX adapter description, markedstatus: optional-not-executed, with no live endpoint, no credentials, and broker ACLs constrained to the outer perimeter.topology.yaml— the Wrangler-style InteractionTopology fragment that binds the nervous-system Picos to the samemanifold-on-kubernetesRuntimeEnvironment used by the Hello Two Picos lab.verify.sh— the deterministic local verifier the walkthrough runs in Step 5.
Commands (recap)
Run from work/hello-pico-nervous-system-mqtt/ after copying the downloads in place (see the walkthrough for the full setup):
bash verify.shExpected output
verify: static — envelope, identity, authorization, correlation, MQTT topic-map, EMQX adapter, and topology all OK
verify: OK — verify passed
Why this satisfies the objectives
- Provider-neutral envelope:
envelope.schema.jsonenumerates the seven envelope kinds in onetypeenum; the sample messages undermessages/cover every kind and the verifier asserts none is missing. - Stable Pico identity vs transport identity: every message names its emitter via
source.pico, drawn frompicos.yaml; the verifier confirmssource.picois registered and is different from every transport identifier present on the same message. - Correlation and delegation: the delegation (
messages/06-delegation.json) and its paired result (messages/07-result.json) share the samecorrelation_id, and the result cites the delegation viacausation_idand carries the samedelegation.mission; the verifier walks this graph. - Event caused by observation:
messages/04-event.jsoncitesmessages/03-observation.jsonviacausation_id; the verifier asserts every event’scausation_idpoints at an observation. - Authorization context:
messages/05-command.jsonandmessages/06-delegation.jsoncarry anauthorizationblock namingprincipal,capability,scope, andgranted_by; the verifier requires both fields to be present. - No live broker, no credentials: the verifier scans every shipped file for credentials, live broker URLs, PEM blocks, and invented
mosquitto/emqxctlcommands.emqx-adapter.yamlis explicitlystatus: optional-not-executedand the verifier fails otherwise. - MQTT/EMQX as optional adapters:
mqtt-topics.yamlmaps every envelope kind to a topic pattern, and every sample MQTT topic matches its expected prefix;emqx-adapter.yamlnames the topic map it implements and marks ACLs as outer-perimeter only. - Kubernetes substrate unchanged:
topology.yamlreusesruntimeEnvironment: manifold-on-kubernetesand names only Picos present inpicos.yaml; no second runtime is introduced.
Variations
- Live MQTT broker: a follow-up lab may add a local
mosquittocontainer and repeat the same verifier against published messages. That lab would flipemqx-adapter.yaml’sstatusfromoptional-not-executedtoexecutedand add a live-path branch to the verifier. - Additional envelope kinds: extending the enum in
envelope.schema.json(e.g.evidence,memory-candidateper Memo 10 § 14) requires adding one sample message and updating the MQTT topic map; the verifier will fail until both are consistent. - Additional Picos: registering another Pico in
picos.yamlwith distinct transport identifiers and referencing it from one new message is enough to grow the topology without changing the envelope.