0
0
plan 0040 step 2: heartbeat names the running version
docs/plans/0040-release-pipeline.md+4−1
| @@ -1,6 +1,6 @@ | ||
# 0040 - Release pipeline: main to staging, rc, self-updating bidders, prod, stable | ||
| ||
Status: plan. The decisions are the owner's (2026-11-15); open questions are at the end. | ||
Status: in progress (owner, 2026-11-16: "yes you're supposed to be building plan 0040"): step 1 built, step 2 built. The decisions are the owner's (2026-11-15); open questions are at the end. | ||
| ||
## Flow | ||
| ||
| @@ -118,6 +118,9 @@ nodemarket). Port parity: the atlibs requester module filters the same way. | ||
| ||
A bidder writes it at start, so a restart after an update announces the new version. | ||
| ||
Built (2026-11-16): lexicon `heartbeat#runningVersion` {version, commit, sha256}; `market.BuildHeartbeat` takes it; the bidder's | ||
`Config.RunningVersion` (`internal/services/bidder/wiring.go`: `buildstamp.Identity()` and `selfexe.Sum()`) goes into every beat. | ||
| ||
### 3. Release records | ||
| ||
All in the `socialweb.computer` repo. | ||
internal/atproto/market/nsid.go+1−1
| @@ -2,7 +2,7 @@ package market | ||
| ||
import "time" | ||
| ||
//go:generate go run ../../lexgen -err ErrInvalidRecord -include com.publicdomainrelay.temp.market.,com.publicdomainrelay.temp.ingress.,com.publicdomainrelay.temp.compute.,com.publicdomainrelay.temp.badgeBlueKeys,network.attested.signature,com.atproto.repo.strongRef -trim com.publicdomainrelay.temp.market.,com.publicdomainrelay.temp.,com.atproto.repo.,network. -name network.attested.signature#signatures=Signatures,com.publicdomainrelay.temp.market.offering#endpoint=Endpoint,com.publicdomainrelay.temp.compute.events.vm.hostKeys#hostKey=HostKey | ||
//go:generate go run ../../lexgen -err ErrInvalidRecord -include com.publicdomainrelay.temp.market.,com.publicdomainrelay.temp.ingress.,com.publicdomainrelay.temp.compute.,com.publicdomainrelay.temp.badgeBlueKeys,network.attested.signature,com.atproto.repo.strongRef -trim com.publicdomainrelay.temp.market.,com.publicdomainrelay.temp.,com.atproto.repo.,network. -name network.attested.signature#signatures=Signatures,com.publicdomainrelay.temp.market.offering#endpoint=Endpoint,com.publicdomainrelay.temp.compute.events.vm.hostKeys#hostKey=HostKey,com.publicdomainrelay.temp.market.heartbeat#runningVersion=HeartbeatVersion | ||
| ||
const ( | ||
StrongRefNSID = "com.atproto.repo.strongRef" | ||
internal/atproto/market/records.go+5−2
| @@ -774,9 +774,12 @@ func OfferingWithdrawn(offering Offering) bool { | ||
return offering.WithdrawnAt != "" && len(offering.AppliesTo) == 0 | ||
} | ||
| ||
func BuildHeartbeat(offeringURI, createdAt string) (Heartbeat, error) { | ||
func BuildHeartbeat(offeringURI, createdAt string, version *HeartbeatVersion) (Heartbeat, error) { | ||
if err := validateRecordURI(offeringURI, "heartbeat offering"); err != nil { | ||
return Heartbeat{}, err | ||
} | ||
return Heartbeat{Offering: offeringURI, CreatedAt: isoOrNow(createdAt)}, nil | ||
if version != nil && version.Version == "" { | ||
version = nil | ||
} | ||
return Heartbeat{Offering: offeringURI, CreatedAt: isoOrNow(createdAt), Version: version}, nil | ||
} | ||
internal/atproto/market/zz_generated.lexicons.go+27−0
| @@ -1717,6 +1717,7 @@ type Heartbeat struct { | ||
Type string `json:"$type"` | ||
CreatedAt string `json:"createdAt"` | ||
Offering string `json:"offering"` | ||
Version *HeartbeatVersion `json:"version,omitempty"` | ||
Extra map[string]json.RawMessage `json:"-"` | ||
absent map[string]json.RawMessage | ||
} | ||
| @@ -1754,6 +1755,32 @@ func (v *Heartbeat) UnmarshalJSON(b []byte) error { | ||
return nil | ||
} | ||
| ||
type HeartbeatVersion struct { | ||
Commit string `json:"commit,omitempty"` | ||
Sha256 string `json:"sha256,omitempty"` | ||
Version string `json:"version"` | ||
Extra map[string]json.RawMessage `json:"-"` | ||
absent map[string]json.RawMessage | ||
} | ||
| ||
func (v HeartbeatVersion) MarshalJSON() ([]byte, error) { | ||
type plain HeartbeatVersion | ||
return marshalOpen(plain(v), v.Extra, v.absent) | ||
} | ||
| ||
func (v *HeartbeatVersion) UnmarshalJSON(b []byte) error { | ||
type plain HeartbeatVersion | ||
var p plain | ||
extra, absent, err := unmarshalOpen(b, &p) | ||
if err != nil { | ||
return err | ||
} | ||
*v = HeartbeatVersion(p) | ||
v.Extra = extra | ||
v.absent = absent | ||
return nil | ||
} | ||
| ||
type HostKey struct { | ||
Fingerprint string `json:"fingerprint"` | ||
PublicKey string `json:"publicKey"` | ||
internal/market/bidder/bidder.go+2−0
| @@ -96,6 +96,8 @@ var ( | ||
type Config struct { | ||
DID string | ||
| ||
RunningVersion *market.HeartbeatVersion | ||
| ||
Workspace string | ||
| ||
ClaimedBy string | ||
internal/market/bidder/offering.go+1−1
| @@ -354,7 +354,7 @@ func (b *Bidder) beat(ctx context.Context) error { | ||
if offering == "" { | ||
return nil | ||
} | ||
record, err := market.BuildHeartbeat(offering, b.now().UTC().Format(time.RFC3339)) | ||
record, err := market.BuildHeartbeat(offering, b.now().UTC().Format(time.RFC3339), b.cfg.RunningVersion) | ||
if err != nil { | ||
return err | ||
} | ||
internal/services/bidder/wiring.go+12−0
| @@ -21,6 +21,7 @@ import ( | ||
"github.com/johnandersen777/socialweb-computer-kcp/api/v1alpha1" | ||
"github.com/johnandersen777/socialweb-computer-kcp/internal/atproto/market" | ||
"github.com/johnandersen777/socialweb-computer-kcp/internal/atproto/xrpc" | ||
"github.com/johnandersen777/socialweb-computer-kcp/internal/buildstamp" | ||
"github.com/johnandersen777/socialweb-computer-kcp/internal/bus" | ||
"github.com/johnandersen777/socialweb-computer-kcp/internal/contract/atprotorepo" | ||
contract "github.com/johnandersen777/socialweb-computer-kcp/internal/contract/market" | ||
| @@ -31,6 +32,7 @@ import ( | ||
"github.com/johnandersen777/socialweb-computer-kcp/internal/ingress/webrtc" | ||
"github.com/johnandersen777/socialweb-computer-kcp/internal/kit/kcp" | ||
"github.com/johnandersen777/socialweb-computer-kcp/internal/kit/pinneddownloads" | ||
"github.com/johnandersen777/socialweb-computer-kcp/internal/kit/selfexe" | ||
core "github.com/johnandersen777/socialweb-computer-kcp/internal/market/bidder" | ||
"github.com/johnandersen777/socialweb-computer-kcp/internal/market/participant" | ||
"github.com/johnandersen777/socialweb-computer-kcp/internal/policyengine/runs" | ||
| @@ -154,6 +156,7 @@ func (s *Service) newBidder(ctx context.Context, intents contract.Intents) (*cor | ||
GuestLANUDP: guestNetwork.LANUDP, | ||
GuestHostUDP: guestNetwork.HostUDP, | ||
GuestNetworkTCP: networkGuestTCP(s.spec.Network), | ||
RunningVersion: runningVersion(), | ||
GuestLANAddresses: s.lanAddresses, | ||
MaxConcurrentGuests: s.spec.MaxConcurrentGuests, | ||
Heartbeat: seconds(s.spec.HeartbeatIntervalSeconds), | ||
| @@ -567,3 +570,12 @@ func networkCABundle(n *v1alpha1.MarketNetworkValue) string { | ||
} | ||
return n.CABundle | ||
} | ||
| ||
func runningVersion() *market.HeartbeatVersion { | ||
version, commit := buildstamp.Identity() | ||
out := &market.HeartbeatVersion{Version: version, Commit: commit} | ||
if pin, err := selfexe.Sum(); err == nil { | ||
out.Sha256 = pin.Sha256 | ||
} | ||
return out | ||
} | ||
lexicons/com/publicdomainrelay/temp/market/heartbeat.json+38−3
| @@ -8,10 +8,45 @@ | ||
"key": "literal:self", | ||
"record": { | ||
"type": "object", | ||
"required": ["offering", "createdAt"], | ||
"required": [ | ||
"offering", | ||
"createdAt" | ||
], | ||
"properties": { | ||
"offering": { "type": "string", "format": "at-uri", "description": "The market.offering this beat keeps alive." }, | ||
"createdAt": { "type": "string", "format": "datetime" } | ||
"offering": { | ||
"type": "string", | ||
"format": "at-uri", | ||
"description": "The market.offering this beat keeps alive." | ||
}, | ||
"createdAt": { | ||
"type": "string", | ||
"format": "datetime" | ||
}, | ||
"version": { | ||
"type": "ref", | ||
"ref": "#runningVersion", | ||
"description": "The bidder build this beat comes from (plan 0040): its version, commit and binary sha256." | ||
} | ||
} | ||
} | ||
}, | ||
"runningVersion": { | ||
"type": "object", | ||
"required": [ | ||
"version" | ||
], | ||
"properties": { | ||
"version": { | ||
"type": "string", | ||
"description": "The build's version, e.g. v0.0.0-rc168." | ||
}, | ||
"commit": { | ||
"type": "string", | ||
"description": "The build's git commit." | ||
}, | ||
"sha256": { | ||
"type": "string", | ||
"description": "The sha256 of the running binary." | ||
} | ||
} | ||
} | ||
.plans.yaml+4−0
| @@ -1,6 +1,10 @@ | ||
# The plans in flight (AGENTS.md "Plan document before work"): one entry per plan being worked, in the order they are done. | ||
# The agent working a plan keeps its entry current: status, the next step, what it waits on. A done plan leaves this file. | ||
plans: | ||
- plan: docs/plans/0040-release-pipeline.md | ||
agent: ci-bootstrap | ||
status: in progress; steps 1-2 built | ||
next: step 3, the release records (project, manifest, version v0.0.0-rc168, channel rc) as socialweb.computer | ||
- plan: docs/plans/0050-staging-pki-dns.md | ||
agent: ci-bootstrap | ||
status: in progress; steps 1-5 built, step 6 for the PLC (one https PLC, DNS/front on 53/443); staging 16/16 in cycle 25 (2e44de85) | ||
AGENTS.md+1−2
| @@ -1085,8 +1085,7 @@ A prod deployment guarantees nothing; the routine path preserves most things. | ||
is a copy of the script for any checkout's use. `tests/gate.sh` takes it itself (for the whole run on a target with a local `network`; on prod, whose VMs run on the prod bidders, only for its build). A dev | ||
network for an item still takes a live slot (`live-slot.ts`) for its whole life, not this lock. | ||
- Before you mark a goal complete cut a release candidate | ||
- Babysit CI every time you tag a release candidate. You are only allowed to | ||
tag rc's, never full releases. | ||
- Babysit CI every time you tag a release candidate. Stable releases are cut by the release pipeline (plan 0040). | ||
- Cut more rc's until CI is green and you have validated that they install and | ||
work on all bidder hosts and prod gateway. | ||
- Never use `/tmp`; it is tmpfs and spills to swap. Use `~/.tmp` (set `TMPDIR` under it). | ||