deploy-ha.sh no longer takes a <data-dir> argument or --build-config
flag. Every deploy now generates a fresh self-signed TLS cert/key
(openssl, RSA 2048, 10y validity) directly into the deploy dir's
certs/, and builds cluster.bin directly into controller/ctrl-1/conf/
via xceadmin -- no intermediate staging directory, nothing preserved
across runs. run-ha-soak.sh (/xce-test-ha) updated to match: dropped
its own XCE_HA_DATADIR-based precondition entirely. Updated 4 callers
(run-ha-soak.sh, test-heartbeat-tolerance.sh, test-commit-durability.sh,
both xce-deploy-ha/xce-test-ha SKILL.md docs).
Separately: xcecommon.wire.connect() was loading a client-side TLS
cert, diverging from the real reference client -- netio.c's
create_ssl_context() presents no certificate at all when acting as a
client (cert_file/key_file both NULL, bare TLS_client_method()).
Fixed connect() to match, and since nothing else consumed cert_dir
(verify_mode=CERT_NONE throughout, no CA check either), removed it
end-to-end: discovery.follow_redirects(), push.push_config()/
probe_config(), and the --cert-dir CLI flag.
Server-side cert loading (mock TLS test servers) is unaffected --
moved into a shared session-scoped tls_certs fixture (new
tests/conftest.py, openssl-generated) replacing 3 duplicated
REPO_HA_DATA_DIR/skipif blocks. Net result: those tests no longer skip
under a hermetic nix build sandbox (which never had ha/data/) --
verified 165/165 passed, 0 skipped, via both meson compile and a full
nix build --option sandbox false .#xcecore_debug rebuild (previously
128 passed / 37 skipped there).
ha/data/{xce.crt,xce.key} removed from git tracking. Requirements
2.3/2.4 and 8.3/8.4/8.5 marked superseded in requirements.md with
dated correction notes.
24 KiB
Requirements Document
Introduction
XCE operators need a tool to build and deploy cluster configuration. Currently, YAML config files (configs/{hosts,queues,resources,users,limits,xce,scaler}.yaml) exist with JSON schemas for validation, but no tool compiles them into the ClusterConfig Cap'n Proto binary the controller expects. The controller-side OP_upgradeConfig handler exists (config_repl.c — receives binary, verifies SHA-256, pushes to standbys, awaits majority ACK), but no CLI sends it.
xceadmin is a Python CLI that fills this gap: config build compiles YAML into cluster.bin, config push sends it to a controller over TLS+capnp.
Config source of truth is git-managed YAML. cluster.bin is a derived artifact — deterministic for the same inputs, never committed to git.
Boundary Context
-
In scope:
- YAML →
ClusterConfigcapnp binary compilation (config build) - TLS+capnp config deployment to controller (
config push) - Auto primary discovery via controller redirect reply
- JSON Schema validation of YAML inputs
- Reserved name defense-in-depth (
"lost_and_found") xcecommonshared Python package (capnp schema, wire protocol, config models)- Integration with xce-build and xce-deploy-ha skills
- Nix dev shell: Python package dependencies
config push --dry-run— validate without committing (nice-to-have)
- YAML →
-
Out of scope:
- Controller-side config replication, snapshot, restart logic (owned by
config-upgrade-snapshot) - Entity-bearing snapshot payload (owned by
entity-bearing-snapshots) - Performance tuning / per-instance parameter extraction (separate work item) — specifically
port, thejobmgr/workermgr/qmgr/resmgrhash-table-size fields, andxstrings(xstring hash size). These are not cluster-shared: each controller instance is expected to set them locally, soxceadminnever reads, accepts, or writes them (see Requirement 1.8). candidates(peer/standby list) — changes independently and more frequently than the rest of cluster config (adding/removing a standby shouldn't require aconfig build/config pushcycle);xceadminnever reads, accepts, or writes it (see Requirement 1.10). Peer membership is owned elsewhere (mechanism TBD — see brief.md Open Design Question #3).configGenerationmanagement — fully controller-owned (see Adjacent Expectations below);xceadminnever reads, increments, or overrides it.- xcecli Python rewrite (future, separate spec)
- Controller config version history, rollback safety validation, config activation status (owned by
config-upgrade-snapshot, see Future Roadmap in brief.md) config diff— deferred to roadmap follow-up (2026-07-21): no operator has asked for it yet; revisit onceconfig pushhas real-world usage (see brief.md R1)
- Controller-side config replication, snapshot, restart logic (owned by
-
Adjacent expectations:
- Controller
OP_upgradeConfighandler (config_repl.c) exists and is operational. On receivingUpgradeConfigRequest{sha256, bytes}:- SHA-256 transit verification
- Cap'n Proto decode + reserved name check (
"lost_and_found") - Auto-increment generation:
new_gen = current_gen + 1, re-encode binary — the primary is the sole authority forconfigGeneration; whatever valuexceadminships incluster.binis discarded and replaced - Save to disk, replicate to standbys, await majority ACK
- Commit
WAL_CONFIG_MARKER, signal controller restart - Return
UpgradeConfigReply{versionTag, ackedCount, error}
- Controller redirect: Standby returns
redirectHost/redirectPortin theRequestReplyunion — xceadmin follows the redirect to reach the primary. - Per-instance field preservation — RESOLVED structurally, not by controller behavior:
port,candidates, the hash-table-size fields, andxstringshave been removed from theClusterConfigcapnp struct entirely (clusterconfig-schema-splitspec, landed commit519e11c).ClusterConfigis now 13 fields (@0–@12,controller.capnp:694-708); these fields simply do not exist incluster.bin— there is no zero-default-clobber risk to guard against. Req 1.8/1.9/1.10 remain as defense-in-depth documentation (if any of these fields is ever reintroduced, xceadmin must still not source it), not as active field-suppression logic. - ProbeConfigTag RPC (
xce_probe_config_tag(),config_repl.c:1829): Separate direct-capnp RPC (not inRequestunion) for reading current config tag. Used byconfig push --dry-runto validate before committing. controller.capnpschema is the single source of truth forClusterConfig,Request/Replyunions, and all OP codes.config-upgrade-snapshotspec will extend the controller-side pipeline with: entity-bearing snapshots after config change, rollback safety validation, version history tracking, config activation status.- Blocked controller-side gaps (NOT owned by admin-config-tool):
- Entity-bearing snapshot after config upgrade (blocked on
entity-bearing-snapshotsspec) - Config rollback safety (e.g., reject rollback while jobs reference deleted queues)
- Config version history query (
xceadmin config history)
- Entity-bearing snapshot after config upgrade (blocked on
- Dependency on
clusterconfig-schema-split— RESOLVED, landed (commit519e11c, phase=implementation-complete). Both subcommands are now unblocked:config build: no dependency, unaffected either way.config push: previously soft-blocked over the risk ofxceadminsilently wipingcandidates/port/perf-tuning on a zero-valued push. That risk no longer exists — those fields are physically absent from theClusterConfigschema, so there is nothing for a push to clobber.config pushmay be exercised against a real cluster without this precondition.
- Controller
Requirements
Requirement 1: Config Build
Objective: As an XCE operator, I want to compile YAML config files into a ClusterConfig capnp binary, so that I can produce a deployable cluster configuration from human-editable source files.
Acceptance Criteria
- When the operator runs
xceadmin config build <configs_dir>, the system shall scan the directory for YAML config files (hosts.yaml,queues.yaml,resources.yaml,users.yaml,limits.yaml,xce.yaml,scaler.yaml), validate each against its corresponding JSON schema bundled withxceadmin, map the validated data to theClusterConfigcapnp struct, serialize it to binary, and write the result tocluster.binin the current working directory. - When the operator specifies
-o <path>, the system shall write the output to the given path instead of the defaultcluster.bin. - When the operator specifies
-o -, the system shall write the binary output to stdout. - After writing output, the system shall print the SHA-256 hash of the resulting binary to stderr.
- Where a YAML file is missing from the configs directory, the system shall treat the corresponding section as empty and continue building (missing files are not errors).
- RESOLVED, superseded (2026-07-21): JSON Schema validation is performed against schemas bundled with the
xceadminpackage (see Requirement 5.5), not aschema/subdirectory the operator supplies.configs_dirtherefore never needs its ownschema/folder, and there is no "missing schema" error mode — the schemas travel with the tool, version-locked to the same release as theClusterConfigfield mapping they validate against (xcecommon.mapping), the same rationale already applied tocontroller.capnp(see Requirement 5.5, brief.md). An operator-suppliedschema/subdirectory, if present, is ignored — not read, not merged, not treated as an override. - Where the YAML content passes JSON Schema validation but maps to fields not present in the
ClusterConfigcapnp struct, the system shall warn the operator about unrecognized fields. - The system shall not source
port, thejobmgr/workermgr/qmgr/resmgrhash-table-size fields, orxstrings(xstring hash size) from YAML or CLI input under any circumstance. These are per-controller-instance performance-tuning parameters, not cluster-shared configuration, and the builtcluster.binshall leave them unset (capnp default). - The system shall not source, read, or write
configGeneration. The builtcluster.binshall leave it unset (capnp default) — the primary controller is the sole authority for assigning it (see Requirement 2 note). - The system shall not source
candidates(controller peer/standby list) from YAML or CLI input. Standby membership changes independently of, and more frequently than, the rest of cluster configuration, so it shall not require aconfig build/config pushcycle; the builtcluster.binshall leavecandidatesunset (capnp default). Peer membership sourcing mechanism is out of scope for this spec (open question — see brief.md Open Design Question #3). clusterName,heartbeatInterval/inactiveHeartbeatCount(controller→worker liveness — not the HA/Raft election heartbeat, which has noClusterConfigfield, see.kiro/steering/config-design.mdRule 0),fetchJobInterval(scheduler job-fetch pass interval), andnetioTimeout(network I/O timeout) SHALL be sourced from a newxce.yamlfile and included incluster.bin— these must stay consistent across all controller instances (unlike Criteria 8–10, which are intentionally excluded). RESOLVED: source isxce.yaml, a flat (non-list) YAML file holding these 5 scalarClusterConfigfields.cluster_nameis required (no sensible default).heartbeat_intervalandfetch_job_intervalare optional — both have controller-side defaults (fill_default_cluster_config(),myconf.c:72-76: 5 and 10 respectively).inactive_heartbeat_countis required and has no controller-side default —cluster.c:1622computes the worker-dead timeout asheartbeat_interval * inactive_heartbeat_count, so an unset (0) value would mark workers dead immediately; xceadmin must not let this ship unset.netio_timeoutis optional; note it currently has no reader anywhere in the codebase outside the struct declaration itself (clusterconfig.h:12) — the field is wired on the wire/schema but not yet consumed by any controller logic. That's a controller-side gap, out of scope for this spec, but xceadmin should still source it from YAML if present rather than silently drop it.hproviders(List(ScalerConfig)— autoscaler provider definitions:name,type,conf_path,script_path,script_option) SHALL be sourced from a newscaler.yamlfile and included incluster.bin. Scaler definitions must be identical across controller instances (a queue configured against a scaler must resolve it the same way after failover) and change rarely — both Configuration Inclusion Rules fail, so this field is included per the Default rule.
Criteria 8–12 apply the Configuration Inclusion Rules (brief.md): a field is excluded from cluster.bin if it can change independently of the rest of cluster config, OR if it's expected to change frequently; otherwise it's included. Any future ClusterConfig field proposed for xceadmin's YAML mapping must be classified against these two rules first.
Requirement 2: Config Push
Objective: As an XCE operator, I want to deploy a compiled cluster.bin to a controller cluster, so that the configuration takes effect on the running system.
Acceptance Criteria
- When the operator runs
xceadmin config push <cluster.bin>, the system shall connect to the controller via TLS, send the binary as a capnpRequestwithOP_upgradeConfigopcode,upgradeconfigrequestmsgbody (binary bytes + SHA-256 hash), framed with an 8-byte uint64 size prefix in host byte order, and display the result. - When the operator specifies
--controller <host:port>, the system shall connect to the given controller address instead of the defaultlocalhost:9991. The system shall use the same TLS certificate bundle the controller cluster is deployed with (Superseded (2026-07-22): verified against the real client TLS setup (xce.crt/xce.key, default pathha/data/) to establish trust — no separate client CA flag or cert-issuance step.netio.c'screate_ssl_context()) that the actual controller-to-controller/CLI client presents no certificate at all when acting as a client (cert_file/key_filebothNULL→ bareTLS_client_method()) — only the server side loads a cert/key pair.xceadmin's client previously diverged from this (loaded a client cert too); fixed to match exactly. No CA flag or cert-issuance step either way —verify_mode=CERT_NONEon both the real client andxceadmin.When the operator specifiesSuperseded (2026-07-22): removed entirely — with no client cert to load,--cert-dir <path>, the system shall loadxce.crt/xce.keyfrom the given directory instead of the defaultha/data/.--cert-dirhad no remaining purpose.ha/data/itself was also removed (deploy-ha.sh and the HA test harness now generate a fresh server-side cert/key per run viaopensslinstead of reading a checked-in fixture).- After receiving the controller's reply, the system shall display the result to the operator:
versionTag(the new generation number assigned by the controller),ackedCount(number of standbys that acknowledged), and anyerrormessage. - When the controller indicates the config was committed (positive
ackedCount), the system shall exit 0. - If the controller reports an error (non-empty
errorfield or zeroackedCount), the system shall display the error and exit non-zero.
Requirement 3: Auto Primary Discovery
Objective: As an XCE operator, I want xceadmin to automatically find the primary controller, so that I don't need to know which node is currently primary.
Acceptance Criteria
- When the operator connects to any controller node (primary or standby), the system shall inspect the reply for
redirectHostandredirectPortfields. If both are non-empty, the system shall reconnect to the redirect target and resend the request. - When the redirect target itself redirects, the system shall follow at most 3 redirect hops before reporting an error.
- When a standby controller redirects the operator to the primary, the system shall display the redirect target to inform the operator where the config was actually pushed.
- When connecting to a controller and no primary has been elected yet, the system shall time out after 30 seconds and report "no primary available" to the operator.
Requirement 4: Validation
Objective: As an XCE operator, I want validation errors caught early, so that invalid configuration never reaches a running cluster.
Acceptance Criteria
- When a YAML file fails JSON Schema validation, the system shall report the specific validation error with file name, line/field path, and the constraint violated, then exit non-zero.
- When a YAML file uses the reserved name
"lost_and_found"for a queue or host, the system shall reject it with a clear error message explaining the reservation, even if it passes schema validation. - When a YAML file contains duplicate entries (duplicate queue names, host names, resource names, group names, limit names — each checked within its own file/section; a limit name is not required to differ from a queue, host, or group name), the system shall report the duplicates and exit non-zero.
- When a YAML file references an undefined entity (e.g., a queue references a host group that is not defined, or a limit references a user/queue/project/host group or a
resnamethat is not defined inresources.yaml), the system shall warn the operator but allow the build to proceed (the controller performs final referential integrity checks at runtime). resources.yamlis the exhaustive resource catalog: everyresnamereferenced elsewhere (e.g.,limits.yaml,queues.yamlsched_stop/res_req/gpu_req,hosts.yamlsched_stop) — including built-in/dynamic resources such asslots,mem, and the 8 per-host attributes the worker registers automatically (type,model,cpuf,maxcpus,maxmem,maxswap,maxtmp,ndisks— seeadd_hostattrs_resvals(),controller/worker.c) — shall be declared as an entry inresources.yaml. The system shall not treat any resource name as an implicit built-in exempt from this catalog; Criterion 4's undefined-entity warning applies equally to built-in resource names.
Requirement 5: xcecommon Shared Package
Objective: As a future Python tool author, I want a shared xcecommon package providing capnp schema loading, wire protocol, and config model types, so that I don't duplicate protocol code across tools.
Acceptance Criteria
- The
xcecommonpackage shall provide a capnp schema loader that readscontroller.capnpand exposes the compiled Python types (ClusterConfig,Request,Reply,UpgradeConfigRequest,UpgradeConfigReply, and all nested types). - The
xcecommonpackage shall provide a wire protocol module that handles TLS connection, capnp message framing (8-byte uint64 size prefix in host byte order), send, and receive. - The
xcecommonpackage shall provide YAML→capnp mapping functions that convert validated YAML data toClusterConfigcapnp struct fields. - Where the
xcecommonpackage is installed for development, it shall be importable under the namexcecommonfrom any tool within the project. - (2026-07-21) The
xcecommonpackage shall bundle its own copy ofcontroller.capnp/c.capnpand the 7 JSON Schema files (one perconfig buildinput file), synced fromsrc/schema/andsrc/configs/schema/respectively at build time (see Requirement 8.1/8.2) and packaged so they are available regardless of install mode (pip install -e .orpip install .). Neither schema is read from a path outside the installed package at runtime; an operator-suppliedconfigs_dir/schema/directory, if present, is not consulted (superseded Requirement 1.6).
Requirement 6: Dry-Run Push (Nice-to-Have)
Objective: As an XCE operator, I want to validate that the controller will accept a config before committing to the push.
Acceptance Criteria
- When the operator runs
xceadmin config push --dry-run <cluster.bin>, the system shall connect to the controller, probe the generation, validate SHA and version compatibility, and report whether the config would be accepted, without actually committing the config to the cluster. - When dry-run passes, the system shall report "OK: controller will accept this config (generation N→M)" and exit 0.
- When dry-run fails, the system shall report the specific rejection reason and exit non-zero.
Requirement 7: Error Handling & Resilience
Objective: As an XCE operator, I want clear, actionable error messages for all failure modes, so that I can diagnose and fix configuration issues without reading controller logs.
Acceptance Criteria
- If the TLS connection to the controller fails, the system shall report "cannot connect to host:port: " and exit non-zero.
- If the controller returns a
Replywith non-zerostatus, the system shall report the status code and any error text from the reply, then exit non-zero. - If the capnp binary is corrupted or cannot be decoded, the system shall report "invalid cluster.bin: " and exit non-zero.
- If the
controller.capnpschema file is not found at the expected path, the system shall report the missing path and suggest checking the installation. - If the operator interrupts the push (SIGINT), the system shall clean up the TLS connection and exit gracefully with a "cancelled" message.
- The system shall time out after 30 seconds on any network operation and report "timeout connecting to host:port".
Requirement 8: Skill & Harness Integration
Objective: As a developer, I want xceadmin integrated into the existing development toolchain, so that building, deploying, and testing XCE clusters uses consistent tooling.
Acceptance Criteria
When the developer runsSuperseded (2026-07-22):/xce-build xceadmin, the system shall make thexceadminCLI available on PATH and run the full test suite, reporting pass/fail.xceadminis now meson-built (src/xceadmin/meson.build) —xce-build.sh xceadmindelegates tomeson compile -C "$BUILD_DIR" xceadmin, andnix build .#xcecore[_debug]installs a standaloneresult/bin/xceadmin(no venv at runtime). See design.md's File Structure Plan Amendment.When the developer runsSuperseded (2026-07-22): the editable-vs-pinned distinction collapsed — every meson-driven build (/xce-build xceadmin release, the system shall installxceadminfor production use (pinned, non-editable) and then run the full test suite against that non-editable install...xce-build.sh xceadmin,meson compile,nix build) now runs the pinned/non-editable install path unconditionally, a strictly stronger guarantee (exercises realpackage_dataresolution every run, not just under areleaseprofile).When the developer runsSuperseded (2026-07-22):/xce-deploy-hawith the--build-configflag, the system shall invokexceadmin config build configs/ -o ha/data/cluster.binas a precondition before deploying the cluster.--build-configremoved entirely — everydeploy-ha.shrun now unconditionally buildscluster.binfresh fromsrc/configs/*.yamldirectly into the deploy dir's owncontroller/ctrl-1/conf/(noha/data/staging step, no flag needed since nothing is ever preserved across runs to opt out of rebuilding).WhenSuperseded (2026-07-22):cluster.binis missing fromha/data/during deploy,/xce-deploy-hashall runxceadmin config buildautomatically (same as--build-config).ha/data/removed entirely (directory no longer exists). See 8.3 above — always-fresh generation directly into the deploy dir replaces the missing-file check.WhenSuperseded (2026-07-22): no longer applicable — nothing persists across deploys for this to preserve; every deploy is fully fresh (cert included, generated viacluster.binalready exists and--build-configis not passed,/xce-deploy-hashall use the existing binary as-is (backward compatible).openssl, self-signed, 10y validity — TLS verification isSSL_VERIFY_NONEeverywhere in this codebase, so a fresh pair per deploy loses no real security property versus a long-lived shared one).- The nix dev shell (
nix develop ./src) shall include all Python dependencies required by xceadmin after the nix environment is updated (see Nix Environment section in brief.md).
Requirement 9: Deterministic Builds
Objective: As an XCE operator, I want config builds to be deterministic, so that I can reproduce any historical config binary from its YAML source.
Acceptance Criteria
- When
xceadmin config buildis run twice with the same YAML inputs and same xceadmin version, the system shall produce byte-identicalcluster.binoutput. - The system shall not embed build timestamps, hostnames, usernames, or any other non-deterministic data in the output binary.
- When different operators on different machines build the same YAML with the same xceadmin version, the output shall be byte-identical.
Requirements Summary
| # | Requirement | Priority | Phase |
|---|---|---|---|
| 1 | Config Build | Core | Implementation |
| 2 | Config Push | Core | Implementation |
| 3 | Auto Primary Discovery | Core | Implementation |
| 4 | Validation | Core | Implementation |
| 5 | xcecommon Package | Core | Implementation |
| 6 | Dry-Run Push | Nice-to-Have | Follow-up |
| 7 | Error Handling | Core | Implementation |
| 8 | Skill & Harness | Core | Implementation |
| 9 | Deterministic Builds | Core | Implementation |