MCPcopy Index your code
hub / github.com/openai/plugins / scan_contract

Function scan_contract

plugins/codex-security/scripts/workbench_db.py:972–996  ·  view source on GitHub ↗
(scan: sqlite3.Row)

Source from the content-addressed store, hash-verified

970
971
972def scan_contract(scan: sqlite3.Row) -> dict[str, Any]:
973 target = Path(scan["target_path"])
974 target_contract = {
975 "allowedKinds": expected_target_kinds(scan),
976 "displayName": target.name,
977 "targetId": stable_target_id(target),
978 }
979 if (
980 scan["mode"] != "diff"
981 and scan["target_snapshot_digest"]
982 and (
983 scan["target_revision"] == "unversioned"
984 or scan["target_snapshot_digest"] != clean_worktree_content_digest()
985 )
986 ):
987 target_contract["requiredSnapshotDigest"] = scan["target_snapshot_digest"]
988 return {
989 "diffTarget": stored_diff_target(scan),
990 "scope": {
991 "requiredExcludePaths": [],
992 "requestedPath": scan["scope"],
993 **({"requiredIncludePaths": [scan["scope"]]} if scan["mode"] != "diff" else {}),
994 },
995 "target": target_contract,
996 }
997
998
999def expected_coverage_mode(scan: sqlite3.Row) -> str:

Callers 2

verify_manifest_bindingFunction · 0.85
scan_resultFunction · 0.85

Calls 4

expected_target_kindsFunction · 0.85
stable_target_idFunction · 0.85
stored_diff_targetFunction · 0.85

Tested by

no test coverage detected