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

@ -1636,7 +1636,12 @@ static void test_jobsubmit_repeated_truncation_forced_failures_no_phantom_jobs(v
* nothing") and is pinned below.) */
static void test_jobsubmit_array_timeout_appends_exactly_one_wal_entry_and_replies_once(void)
{
const uint64_t base_jobid = 9140;
/* job-array-one-based-index task 2.1 (Req 7.1-7.3): an array
* submission must carry the array tag and start at element 1 of an
* aligned block; untagged multi-element or index-0 IDs are rejected by
* jobsubmit_classify before reaching the commit path under test. */
const uint64_t base_jobid = MAKE_JOBID(
0, 0, 0, TAG_JOB_ARRAY, ((uint64_t)1 << N_ARRAY_IDX_BITS) | 1);
const uint64_t array_size = 3;
uint64_t lsn_before, watermark;
int create_rc, join_rc;
@ -1871,7 +1876,9 @@ static void test_jobsubmit_success_reply_after_apply_carries_jobid(void)
static void test_jobsubmit_array_success_appends_one_entry_and_replies_once_with_base_jobid(
void)
{
const uint64_t base_jobid = 9210;
/* tagged block|1 first ID (job-array-one-based-index task 2.1) */
const uint64_t base_jobid = MAKE_JOBID(
0, 0, 0, TAG_JOB_ARRAY, ((uint64_t)2 << N_ARRAY_IDX_BITS) | 1);
const uint64_t array_size = 3;
uint64_t lsn_before, watermark;
cbrp_reply_obs_t final = { 0 };