feat(job-array-one-based-index): classify every job submission first (task 2.1)

handle_jobsubmit classifies (first_jobid, array_size) before the field
checks, the before-event hook and any registry access: a tagged array
starting at index 0 is answered with the new E_XCE_ARRAY_START0 and an
ERROR log asking for the client to be upgraded (7.1, wins per 7.9);
size 0, tags 2/3, untagged multi-element submissions and arrays whose
last element exceeds 32767 (checked without addition) get -EINVAL.
Nothing is stored for a rejected submission. This also closes a crash:
a size-0 submission used to reach payload building and overflow calloc.
Existing array tests move to tagged block|1 first IDs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-10-01 09:44:12 +00:00
parent ef728435d4
commit e6c484a0e7
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
11 changed files with 574 additions and 19 deletions

View file

@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unity/unity.h>
#include "utils.h"
@ -76,6 +77,20 @@ static void test_strerror_out_of_range(void)
TEST_ASSERT_TRUE(strcmp(buf, "unknown error") == 0);
}
/* job-array-one-based-index (Req 7.1): the distinct array-numbering status
* sits right after E_XCE_STANDBY and its text says numbering starts at 1
* and the client must be upgraded. */
static void test_strerror_array_start0(void)
{
char buf[128];
TEST_ASSERT_EQUAL_INT(E_XCE_STANDBY + 1, E_XCE_ARRAY_START0);
TEST_ASSERT_EQUAL_INT(0,
xce_strerror_r(E_XCE_ARRAY_START0, buf, sizeof(buf)));
TEST_ASSERT_NOT_NULL(strstr(buf, "start at 1"));
TEST_ASSERT_NOT_NULL(strstr(buf, "upgrade"));
}
void test_error(void)
{
printf("\n>> error test\n\n");
@ -83,6 +98,7 @@ void test_error(void)
RUN_TEST(test_error_setget);
RUN_TEST(test_strerror_all_xce_codes);
RUN_TEST(test_strerror_out_of_range);
RUN_TEST(test_strerror_array_start0);
#if 0
RUN_TEST(test_strerror_r);
#endif