test_the_spawn_site_names_its_enclosing_function

Tests › tests/test_thread_spawns.py

passed Passed in the packaged run.

What this test is for

Why it exists

A COORDINATE WITH NO NAME IS WHY THE AGENT READ THE FILE. Build 35 gave the thread row its spawn file and line, so an agent could be told a thread is created at `programs/ssl/ssl_pthread_server.c:277` and still have nothing to ask a follow-up ABOUT. Measured on mbedtls 2026-08-14: the enclosing function is `thread_create`, whose body holds the one shared `mbedtls_ssl_config`, the `pthread_join` and the compile guard — four graded marks — and `dossier('thread_create')` already returned all of it. Only the route was absent.

Given

  1. —
→

When

  1. patterns = patterns_by_name(load_thread_patterns(None))
  2. src = ( b"#include <pthread.h>\n" b"static void *WorkerProc(void *a) { return a; }\n" b"int thread_create(void) {\n" b" pthread_t t;\n" b" return pthread_create(&t, NULL, WorkerProc, NULL);\n" b"}\n" b"void *raced = (void *) 0;\n" )
  3. tree, raw = _parse_c(src)
3 more
  1. sites = _walk_spawn_sites(tree, raw, patterns)
  2. file_scope, raw2 = _parse_c( b"#include <pthread.h>\n" b"static void *P(void *a) { return a; }\n" b"pthread_t g;\n" b"int ignored = 0;\n" )
  3. _walk_spawn_sites(file_scope, raw2, patterns)
→

Then

  1. ✓ len(sites) equals 1
  2. ✓ len(sites[0]) equals 10
  3. ✓ sites[0][8:] equals ["unknown", None]
  4. ✓ sites[0][6] equals "thread_create"
  5. ✓ _walk_spawn_sites(file_scope, raw2, patterns) equals []

What it exercises

The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.

clew — `main` (clew/cli.py) · 1 of 400 steps

… 80 earlier steps

command-line usercommand-line usercommand-line usercommand-line userother filesother filesother filesother filesopt (line 288)optmain81–82. _ast_parse_one_file → _ts_language_for81_ts_language_for +1 more83. _cached_parser → _try_import_ts_module83_try_import_ts_module▶ test enters84–85. _ast_parse_one_file → _parseable_file84_parseable_file +1 more

… 315 later steps

tests/test_thread_spawns.py:408 · its file's page

What it checks (5)

  1. assert len(sites) == 1, f"expected the one pthread spawn, got {sites}" observes _walk_spawn_sites via sites
  2. assert len(sites[0]) == 10, f"the payload must have ten elements, got {len(sites[0])}" observes _walk_spawn_sites via sites
  3. assert sites[0][8:] == ["unknown", None], "a pthread_t nobody joins or detaches" observes _walk_spawn_sites via sites
  4. assert sites[0][6] == "thread_create" observes _walk_spawn_sites via sites
  5. assert _walk_spawn_sites(file_scope, raw2, patterns) == [] observes _walk_spawn_sites

Where the product reaches it

No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.

Call flow

test_the_spawn_site_names_its_enclosing_function→patterns_by_name→load_thread_patterns→_parse_c→_walk_spawn_sites

What it reaches

Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.

test_the_spawn_site_names_its_enclosing_function · 5 checks_walk_spawn_sitesis_python_treeREQ-DDB-PIPE-003 · measuredload_thread_patternsREQ-DDB-SCHEMA-001 · measuredload_thread_patternsdeclaration_originREQ-DDB-SCHEMA-012 · inferred
Also reaches 3 requirements

Its run touches their code; that is reach, not proof.