Repository navigation
Description
Summary
Add objectfs cluster status subcommand that queries the running ObjectFS instance's health endpoint and displays cluster state in human-readable or JSON format.
Background
Operators need a way to quickly assess cluster health without parsing logs or writing curl commands. This subcommand follows the same pattern as etcdctl endpoint status and consul members.
Implementation
cmd/objectfs/main.go — add cluster subcommand with nested status:
objectfs cluster status [--json] [--endpoint http://localhost:8081]
Connects to the health endpoint (default http://localhost:8081/health/cluster), displays:
ObjectFS Cluster Status
=======================
Node: node-1 (this node)
Role: Leader
Address: 10.0.1.1:7946
Peers (3 alive, 0 suspect, 0 dead):
node-2 10.0.1.2:7946 alive leader=false cache_hit=84%
node-3 10.0.1.3:7946 alive leader=false cache_hit=71%
Cache:
Hit rate: 78%
Size: 12.4 GB / 20 GB
Top 5 keys by access:
genomics/sample-42/reads.bam (1,204 reads in last 5m)
genomics/reference/hg38.fa (892 reads in last 5m)
...
With --json:
{
"node_id": "node-1",
"role": "leader",
"peers": [...],
"cache": {...},
"top_keys": [...]
}Exit codes:
- 0: healthy, quorum present
- 1: instance unreachable OR quorum lost
Health endpoint changes
Extend internal/health/ to expose /health/cluster endpoint returning the cluster status JSON payload.
Acceptance Criteria
- Human-readable output includes all fields listed above
-
--jsonflag produces valid JSON - Exit code 1 when instance is not running
- Exit code 1 when quorum is lost (fewer than majority alive)
-
go test ./cmd/objectfs/...passes
Dependencies
- Requires B1-1 (subcommand routing in main.go)
Activity
scttfrdmn commentedon Jul 30, 2026
Correction: mislabeled track, and three of the four data fields do not exist
Filing note from the v0.10.0 review — the premises here need adjusting before anyone starts.
This is distributed work, not packaging work. Filed under Track B (install/ops), but every field the subcommand needs to display comes from
internal/distributed. It cannot be implemented without the consensus/cluster layer being live in the process.Blocking dependencies not currently listed. The issue lists only #134.
ClusterManagerexists in a runningobjectfsprocess. Nothing constructs one on the mount path — that is A2-1: Wire ClusterManager into Adapter and FileSystem #139, which itself cannot compile as written (see the correction comment on A2-1: Wire ClusterManager into Adapter and FileSystem #139:config.ClusterConfiganddistributed.ClusterConfigare disjoint types and need a translation layer no issue covers).cache_hitis always0.NodeMetrics.CacheHitRate(internal/distributed/cluster.go:84) is declared but never populated. That is A1-5: Populate NodeInfo stats via gossip heartbeat #132.topkeys/top_keys/TopKeysByAccessreturns zero hits across all Go files. There is no access-frequency index to read from, ininternal/cacheor elsewhere. This is net-new work, not a display concern.Suggested adjustment
area: distributed(keeptype: enhancement).The remaining fields (node ID, status, addresses) are genuinely reachable once #139 lands, so the subcommand is worth keeping as-is otherwise.
scttfrdmn commentedon Aug 2, 2026
Correction: this is distributed work filed as CLI work, and most of what it displays does not exist
Re-verified against
main. The subcommand is a thin shell; everything behind it is unbuilt, and the issue's framing hides that.1. There is no
/health/clusterendpoint, and no cluster-aware health surface at all.internal/health/checker.go:145registers exactly one path,/health(:474). The issue mentions extendinginternal/health/in a one-line aside under "Health endpoint changes" — but that extension is the whole feature. The CLI ishttp.Getplus formatting.2. Every field in the sample output depends on unlanded issues:
Role: Leader,leader=falseClusterManager.IsLeaderexists, butbroadcastProposal(consensus.go:754-759) self-accepts proposals in simulation, so leadership is not a cluster fact yet (#133)Peers (3 alive, 0 suspect, 0 dead)NodeInfostats are not populated by gossipcache_hit=84%per peerNodeInfo.CacheHitRateexists (cluster.go:85) andcalculateClusterStatsaverages it (:532-551), but nothing ever writes a nonzero value into a peer's copyTop 5 keys by accessKeyAnnouncementmap does not exist; no per-key access counters exist anywhereCache: 12.4 GB / 20 GBSo of the four display blocks, one is implementable now.
3. "Exit code 1 when quorum is lost" is not decidable from current state. Quorum requires knowing the configured member set and which members are alive. Alive-ness is #132. Without it the check degrades to "how many nodes are in my local map", which after a partition is exactly the number that makes a minority believe it has quorum.
4. Relabel. This is
area: distributed, notarea: core, and its dependency list should read #132, #140, and #134 — not #134 alone. As filed under a packaging-adjacent title it reads like an afternoon of CLI work; it is the observability surface for the entire distributed layer and cannot ship ahead of it.Suggested split, so something useful can land early:
objectfs status(nocluster) — node ID, mount point, uptime, cache size/hit rate, S3 request counts. All available today, useful to every single-node user, and it establishes the--jsoncontract and exit-code convention that the cluster version reuses.objectfs cluster statuswith peers, roles, and top keys.Accurate as written: the
etcdctl endpoint status/consul membersprecedent is the right model,--jsonalongside human output is right, and distinguishing exit code 0 from 1 on quorum rather than only on reachability is the correct instinct once quorum is knowable.scttfrdmn commentedon Aug 9, 2026
Scoping note before implementation: the endpoint this issue specifies does not exist.
The body says the subcommand reads
http://localhost:8081/health/cluster.internal/health/checker.goregisters exactly one handler, atc.config.HTTPPath— default/health(checker.go:192,:605) — and greppinginternal/health/for "cluster" returns nothing outside tests. The health package knows nothing about clustering, so this issue as written is a client for a server that was never built.So the work is two halves, server first: publish cluster state from the accessors
ClusterManageralready has (GetNodeID,GossipAddr,GetNodes,GetStats,IsLeader,GetLeader—cluster.go:413-490), then the subcommand that reads it.Second scoping note, on the mockup: it shows
leader=falseper peer, per-peercache_hit=%, and a "Top 5 keys by access" section. Each needs verifying as populated before it is displayed.IsLeaderin particular will be false on every node, because v0.13.0 deliberately does not start consensus on the mount path — coordination is compare-and-swap, not Raft — so printingRole: Followerfor a healthy single-node cluster would be misleading. A field that is not measured must not print as a zero: that is #222 (percentiles declared, never assigned, published as zeros) repeated in a new place.feat(cluster): objectfs cluster status, and the endpoint it reads (#147…