feat(job-array-one-based-index): client identity and selection parser (task 8.1)

xcecli's format package gains ParseSelection (written or decimal key
with optional [k]/[a-b], the server's grammar and check order; 5.8 and
5.7 also on decimal keys with [...], so an upgraded client protects
itself against an older server; query ranges refused after the other
checks), the bracket-aware SplitSelections, the raw -J
ParseNameSelection and Selection.APIKey. ParseJobID is bounded;
ToAPIJobID(s, allowRange) no longer passes unrecognised text through;
peek keeps today's behaviour via ToAPIJobIDLegacy.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-10-01 12:47:39 +00:00
parent 1fa0107357
commit bc616e8c4a
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
9 changed files with 866 additions and 39 deletions

View file

@ -49,7 +49,7 @@ func (c *JobController) RunJobsControl() error {
func (c *JobController) controlJobsByIDs(apiClient *request.APIClient, token string) error {
apiIDs := make([]string, 0, len(c.jobIDs))
for _, id := range c.jobIDs {
apiID, err := format.ToAPIJobID(strings.TrimSpace(id))
apiID, err := format.ToAPIJobID(strings.TrimSpace(id), true)
if err != nil {
return fmt.Errorf("invalid job ID %q: %w", id, err)
}