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

Function native_log

tests/coverage_live_v2_native.py:140–157  ·  view source on GitHub ↗
(destination, record)

Source from the content-addressed store, hash-verified

138
139
140def native_log(destination, record):
141 require(isinstance(record, dict) and isinstance(record.get("path"), str)
142 and "capture" in record, "native capture log metadata")
143 path = Path(record["path"])
144 require(path.is_absolute(), "native capture path must be absolute")
145 try:
146 relative = path.relative_to(destination)
147 except ValueError as exc:
148 raise Regression("native capture path escaped owned bundle") from exc
149 require(relative.parts and ".." not in relative.parts, "native capture path traversal")
150 current = destination
151 for part in relative.parts:
152 current = current / part
153 require(not current.is_symlink(), "native capture path contains symlink")
154 data = read(path, 32 * 1024 * 1024)
155 require(type(record.get("bytes")) is int and record["bytes"] == len(data)
156 and record.get("sha256") == digest(path), "native capture length/digest mismatch")
157 return data
158
159
160def retained_profiles(destination):

Callers 1

bundleFunction · 0.85

Calls 6

requireFunction · 0.90
RegressionClass · 0.90
digestFunction · 0.90
readFunction · 0.70
getMethod · 0.65
typeFunction · 0.50

Tested by

no test coverage detected