MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / dependency_controls

Function dependency_controls

tests/coverage_live_v2_native.py:56–94  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

54
55
56def dependency_controls(context):
57 root = context.output / "native-controls"
58 root.mkdir()
59 raw = root / "raw"
60 raw.mkdir()
61 env = clean_env()
62 env["LLVM_PROFILE_FILE"] = str(root / "listing.profraw")
63 listing = context.processes.run("native-list", [context.runner, "--list-suites"], env, timeout=70)
64 require(listing["exit"] == 0 and SUITE.encode() in read(listing["stdout"]).splitlines(),
65 "real runner does not list setup fixture")
66 universe = convert(context, root / "listing.profraw", "native-list-text")
67 require(any(not any(values) for values in universe.values()), "native enumeration has no zero-record control")
68 require(any(key[0] == FUNCTION for key in universe), "native enumeration lacks exact setup identity")
69 require(not any(key[0] == b"__cbm_live_v2_test_unknown_identity__" for key in universe),
70 "administrative unknown-identity sentinel collides with native universe")
71 env["LLVM_PROFILE_FILE"] = os.devnull
72 env["CBM_TEST_COVERAGE_DIR"] = str(raw)
73 suite = context.processes.run("native-setup", [context.runner, SUITE], env, timeout=70)
74 require(suite["exit"] == 0, "real setup fixture process failed")
75 native_summary(read(suite["stdout"]))
76 events = [json.loads(line[len(b"COV_CHILD "):]) for line in read(suite["stderr"]).splitlines()
77 if line.startswith(b"COV_CHILD ")]
78 selected = [event for event in events if event.get("id") == "setup_ok"]
79 require([event.get("stage") for event in selected] == ["ready", "reaped"],
80 "setup child custody control differs")
81 require(selected[0].get("marker") == 1 and selected[1].get("marker") == 0
82 and selected[1].get("code") == 0 and selected[0].get("pid") == selected[1].get("pid"),
83 "setup child did not successfully write, retire marker and reap")
84 child = raw / SUITE / ("_setup.child.%d.profraw" % selected[1]["pid"])
85 child_records = convert(context, child, "native-setup-child-text")
86 require(set(child_records) == set(universe) and all(len(child_records[key]) == len(universe[key])
87 for key in universe), "native full-record shape control")
88 require(any(any(values) for key, values in child_records.items() if key[0] == FUNCTION),
89 "genuine setup child did not hit setup counter")
90 for test in TESTS:
91 require(bool(read(raw / SUITE / (test + ".parent.profraw"))), "missing native parent control")
92 return universe, {"listing": listing, "suite": suite, "child_profile": str(child),
93 "child_sha256": digest(child), "events": selected,
94 "universe_records": len(universe), "actual_setup_hit": True}
95
96
97def bundle(context, destination, registry, tests, outcome, exit_code):

Callers 1

mainFunction · 0.90

Calls 11

clean_envFunction · 0.90
requireFunction · 0.90
digestFunction · 0.90
strFunction · 0.85
convertFunction · 0.85
native_summaryFunction · 0.85
setFunction · 0.85
readFunction · 0.70
getMethod · 0.65
allFunction · 0.50
runMethod · 0.45

Tested by 1

mainFunction · 0.72