fix(frontend): peek and restart take <array-id>[k] and written job IDs

- apiserver peek (parseJobIDParam): <array-id>[k] now resolves to the
  element; it used to drop [k] and look up the array identity itself
  (and panicked in parseArrayName on some inputs). A job number still
  names that job exactly (an element by its own XCE_JOBID); ranges and
  invalid selections are rejected.
- apiserver restart: the decimal-only pre-check (isValidJobId, now
  unused and removed) rejected the written form c-a-ts-seq[k];
  ParseIdentitySelection, already used for the lookup, validates it.
- xcecli jobs restart converts its argument with ToAPIJobID like the
  control commands, so written IDs work and invalid ones fail locally.
- docs: the peek/restart caveat in the Job arrays section.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-10-02 09:42:27 +00:00
parent a65146a9ae
commit c15580a7f3
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
7 changed files with 126 additions and 35 deletions

View file

@ -1470,6 +1470,8 @@ func TestJobHandler_RestartNamedJob(t *testing.T) {
}{
{"ordinary job by decimal id", strconv.FormatUint(ord, 10), "ordinary"},
{"array element by <array-id>[k]", strconv.FormatUint(arr, 10) + "[2]", "elem-2"},
{"array element by written <array-id>[k]", backend.FormatJobID(int64(arr)) + "[2]", "elem-2"},
{"ordinary job by written id", backend.FormatJobID(int64(ord)), "ordinary"},
}
for _, c := range cases {
before := len(f.submitted)