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

Function invalid_registry

tests/coverage_live_v2_admin.py:63–97  ·  view source on GitHub ↗
(context, case)

Source from the content-addressed store, hash-verified

61
62
63def invalid_registry(context, case):
64 runner, marker = untouched_runner(case)
65 image = digest(runner)
66 valid = {"format": "cbm.coverage.registry.v0", "image_sha256": image,
67 "suites": [{"name": "coverage_setup_success", "tests": ["coverage_setup_first"]}]}
68 samples = {
69 "duplicate-key": ('{"format":"cbm.coverage.registry.v0","format":"cbm.coverage.registry.v0",'
70 '"image_sha256":"%s","suites":[]}' % image).encode(),
71 "invalid-utf8": b"\xff",
72 "oversize": b" " * (2 * 1024 * 1024 + 1),
73 "extra-evidence": json.dumps(dict(valid, runtime_supported=True)).encode(),
74 }
75 for index, test in enumerate(("../escape", "a/b", "a\\b", ".", "..", "_setup", "_setup.child")):
76 item = dict(valid, suites=[{"name": "coverage_setup_success", "tests": [test]}])
77 samples["routing-%d" % index] = json.dumps(item).encode()
78 for name, content in samples.items():
79 directory = case / name
80 directory.mkdir()
81 registry = directory / "registry.json"
82 registry.write_bytes(content)
83 process, destination = context.collect(directory, registry, runner=runner)
84 no_marker(process, destination)
85 require(not marker.exists(), "invalid registry reached runner")
86 linked = case / "linked-registry"
87 linked.mkdir()
88 target = linked / "actual.json"
89 target.write_text(json.dumps(valid), encoding="utf-8")
90 registry = linked / "registry.json"
91 registry.symlink_to(target)
92 before = digest(target)
93 process, destination = context.collect(linked, registry, runner=runner)
94 no_marker(process, destination)
95 require(registry.is_symlink() and digest(target) == before and not marker.exists(),
96 "registry symlink was followed or changed")
97 return {"class": "administrative", "invalid_samples": list(samples), "symlink_preserved": True}
98
99
100def bounds(context, case):

Callers 1

mainFunction · 0.90

Calls 6

digestFunction · 0.90
requireFunction · 0.90
untouched_runnerFunction · 0.85
no_markerFunction · 0.85
collectMethod · 0.80
listFunction · 0.50

Tested by 1

mainFunction · 0.72