Merge remote-tracking branch 'origin/main' into fix/php-global-use-known-absent

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
This commit is contained in:
Martin Vogel committed 2026-10-18 23:58:22 +02:00
commit 7cb58d3f15
21 files changed
+2315 -133

No files matched your search

+86
View File
@@ -847,6 +847,91 @@ TEST(parallel_args_json_no_overflow) {
PASS();
}
/* F14: a definition's properties buffer was sized for its docstring and variants
* only. A wide signature (50 annotated parameters) filled the rest of the 2 KB, and
* the MinHash fingerprint "fp", structural profile "sp" and body tokens "bt"
* appended behind it were dropped whole: no SIMILAR_TO edge and fewer
* SEMANTICALLY_RELATED edges for exactly the widest definitions (jellyfin's
* ImageController actions, 2026-10-18). `small` has the same body and is the
* control that the fixture produces all three at all. Both resolvers. */
static const char f14_body[] =
" total = 0\n"
" for item in range(10):\n"
" if item % 3 == 0:\n"
" total += item * 2\n"
" elif item % 5 == 1:\n"
" total -= len(str(item))\n"
" else:\n"
" total ^= hash((item, total))\n"
" values = [x * x for x in range(total % 7 + 3)]\n"
" mapping = {str(k): v for k, v in enumerate(values)}\n"
" while total > 100:\n"
" total //= 3\n"
" try:\n"
" result = sorted(mapping.items(), key=lambda kv: kv[1])\n"
" except ValueError as err:\n"
" result = [(\"error\", str(err))]\n"
" return result, total, mapping\n";
static bool f14_props_have(const cbm_gbuf_t *gb, const char *project, const char *name,
const char *venue) {
char *qn = cbm_pipeline_fqn_compute(project, "pkg/wide.py", name);
const cbm_gbuf_node_t *n = qn ? cbm_gbuf_find_by_qn(gb, qn) : NULL;
free(qn);
const char *p = n && n->properties_json ? n->properties_json : "";
bool fp = strstr(p, "\"fp\":\"") != NULL;
bool sp = strstr(p, "\"sp\":\"") != NULL;
bool bt = strstr(p, "\"bt\":\"") != NULL;
bool sig = strstr(p, "\"signature\":\"") != NULL;
printf(" f14 %s %s: found=%d len=%zu fp=%d sp=%d bt=%d signature=%d\n", venue, name, n != NULL,
strlen(p), fp, sp, bt, sig);
return n && fp && sp && bt && sig;
}
TEST(parallel_wide_definition_keeps_fp_sp_bt_f14) {
char params[CBM_SZ_4K];
size_t pos = 0;
for (int i = 0; i < 50; i++) {
pos += (size_t)snprintf(params + pos, sizeof(params) - pos, "%sp%02d: Dict[str, int] = None",
i ? ", " : "", i);
}
char src[CBM_SZ_8K];
snprintf(src, sizeof(src), "def small(a, b):\n%s\n\ndef wide(%s):\n%s", f14_body, params,
f14_body);
const char *project = "cbm_f14";
char tmpdir[256];
snprintf(tmpdir, sizeof(tmpdir), "/tmp/cbm_par_f14_XXXXXX");
if (!cbm_mkdtemp(tmpdir)) {
FAIL("mkdtemp failed");
}
char path[512];
snprintf(path, sizeof(path), "%s/pkg/wide.py", tmpdir);
if (th_write_file(path, src) != 0) {
th_rmtree(tmpdir);
FAIL("failed to write the F14 fixture");
}
cbm_file_info_t files[1] = {0};
files[0].path = path;
files[0].rel_path = (char *)"pkg/wide.py";
files[0].language = CBM_LANG_PYTHON;
cbm_gbuf_t *graphs[2] = {run_sequential(project, tmpdir, files, 1),
run_parallel(project, tmpdir, files, 1, 2)};
ASSERT_NOT_NULL(graphs[0]);
ASSERT_NOT_NULL(graphs[1]);
bool all = true;
for (int g = 0; g < 2; g++) {
const char *venue = g == 0 ? "sequential" : "parallel";
bool control = f14_props_have(graphs[g], project, "small", venue);
bool wide = f14_props_have(graphs[g], project, "wide", venue);
all = all && control && wide;
}
cbm_gbuf_free(graphs[0]);
cbm_gbuf_free(graphs[1]);
th_rmtree(tmpdir);
ASSERT_TRUE(all);
PASS();
}
/* ── Graph buffer merge tests ─────────────────────────────────────── */
TEST(gbuf_shared_ids_unique) {
@@ -5515,6 +5600,7 @@ SUITE(parallel) {
RUN_TEST(parallel_post_extract_projection_spills_before_resolve);
RUN_TEST(parallel_empty_files);
RUN_TEST(parallel_args_json_no_overflow);
RUN_TEST(parallel_wide_definition_keeps_fp_sp_bt_f14);
/* Cleanup shared state */
parity_teardown();