fix(xce-test-cli-ux): fix bug-1557's join maxmem default

cmd_join_worker's simulated-worker maxmem default was 64 bytes -- a
leftover from when the field was MB-scale, unfixed when maxmem became
bytes-canonical elsewhere. Now 64 * 1024 * 1024. Extracted the
argument-parsing/defaulting logic into join_worker_parse_attrs()
(join_worker_args.c), since it runs entirely before the function's
network call and is a genuine testable seam -- same precedent as
task 2.5's joblist_display.c. Verified live against a real deployed
cluster (workerlist reports MaxMem: 64.00 MB) plus a permanent 5-test
regression suite. maxswap/maxtmp have the identical stale-default bug
(logged as bug-1793) but are deliberately left unfixed here since
USAGE_JOIN_WORKER's help text currently documents their stale values
accurately -- fixing only the code would create a new docs mismatch;
a locked-in sibling-defaults test documents this for the follow-up.
1353/1353 across the full controller suite (+5), 0 regressions.

Task 2.6 of .kiro/specs/xce-test-cli-ux/tasks.md.
Requirements: 12.1

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019jaMf9QEwpugH2W9KAuc7f
This commit is contained in:
Rongsong Shen 2026-09-09 16:24:36 +00:00
parent a8154acb0a
commit 878a42fb48
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
7 changed files with 304 additions and 40 deletions

View file

@ -35,6 +35,8 @@
#include "confirm.h" /* destructive-command confirmation gate (xce-test-cli-ux task 2.1) */
#include "joblist_display.h" /* worker_status_str/job_state_str/format_job_time
* (xce-test-cli-ux task 2.5 remediation) */
#include "join_worker_args.h" /* join_worker_parse_attrs (xce-test-cli-ux
* task 2.6 remediation, bug-1557) */
#include "rcfile.h" /* startup rc-file path resolution + loading (xce-test-rc-file task 2.2) */
#include "resval_typeresolve.h" /* resval_resolve_type (resource-value-verification task 2.1) */
#include "xce/cluster.h" /* xce_parse_peers, xce_cluster_config_t */
@ -3363,46 +3365,19 @@ int cmd_join_worker(int argc, char* argv[])
{
int rc;
int role;
int opt;
hostattrs_t attrs = { .cpufactor = 1.0,
.maxcpus = 4,
.maxmem = 64,
.maxswap = 1024,
.maxtmp = 2048,
.ndisks = 1 };
hostattrs_t attrs;
role = HostRole_worker;
optind = 1;
attrs.hostmodel = "Intel64";
attrs.hosttype = "LINUX64";
while ((opt = getopt(argc, argv, "f:c:m:s:t:d:")) != -1) {
switch (opt) {
case 'f':
attrs.cpufactor = atof(optarg);
break;
case 'c':
attrs.maxcpus = atoi(optarg);
break;
case 'm':
attrs.maxmem = atoi(optarg);
break;
case 's':
attrs.maxswap = atoi(optarg);
break;
case 't':
attrs.maxtmp = atoi(optarg);
break;
case 'd':
attrs.ndisks = atoi(optarg);
break;
default:
printf(" join [-f cpufactor] [-c maxcpus] [-m maxmem] [-s maxswap] "
"[-t maxtmp] [-d ndisks]\n");
return -EINVAL;
}
/* xce-test-cli-ux task 2.6 remediation (bug-1557): the argument-parsing/
* defaulting block (including the maxmem default fix) is extracted into
* join_worker_args.c/.h so it can be unit-tested in isolation from this
* function's REPL/network state -- see join_worker_args.h for the full
* rationale. This is a structural extraction only; the parsing/defaulting
* behavior and everything from xcecli_join() onward are unchanged. */
rc = join_worker_parse_attrs(argc, argv, &attrs);
if (rc < 0) {
return rc;
}
rc = xcecli_join(active_ctx->ctx, role, &attrs);