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:
parent
a65146a9ae
commit
c15580a7f3
7 changed files with 126 additions and 35 deletions
|
|
@ -839,12 +839,6 @@ func (j JobController) RestartJobByID(ctx *gin.Context) {
|
|||
logger.Debug("Receive job restart request:",
|
||||
zap.String("jobId", jobIDStr), zap.String("restarter", restarter))
|
||||
|
||||
if err = isValidJobId(jobIDStr); err != nil {
|
||||
logger.Error(err.Error())
|
||||
ReturnError(ctx, common.INVALID_PARAMS_CODE, common.INVALID_PARAMS_MSG+": "+err.Error(), nil)
|
||||
return
|
||||
}
|
||||
|
||||
// check post body whether correct
|
||||
var req models.JobRestartRequest
|
||||
if err := utils.BindJSONStrict(ctx, &req); err != nil {
|
||||
|
|
@ -1775,15 +1769,6 @@ func isValidArrayName(arrayName string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func isValidJobId(jobID string) error {
|
||||
matched, _ := regexp.MatchString(`^\d+$`, jobID)
|
||||
matchedIndex, _ := regexp.MatchString(`^\d+\[\d+\]$`, jobID)
|
||||
if !matched && !matchedIndex {
|
||||
return fmt.Errorf("jobid '%s' contains invalid characters. Allowed characters are 0-9 or with index value", jobID)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateAskedHosts(askedHosts string) error {
|
||||
if askedHosts == "" {
|
||||
return nil // Nothing to validate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue