Check a crate against the code gate
code_gateCheck source policy before submission (no #![forbid(unsafe_code)] at the crate root = CODE_UNSAFE_PERMITTED; a dependency besides ferrite-app). Fix violations before continuing. Admission is not compilation or a test verdict. For existing-app repairs, commit changed files and deploy the exact returned reference; see rcs_commit.
Cargo.toml: [package] name="" version="0.1.0" edition="2021" [dependencies] ferrite-app={path="../ferrite-app"}
API for handle() in deploy_source's loop. Request: req.method, req.path (may end ?query), req.body (Vec; a form post is urlencoded), req.idempotency_key, req.headers (only those the route lists, e.g. add "forward_headers":["cookie"] to the spec's route to read a cookie). Reply: let mut r=IngressReply::to(req,200,html.into_bytes()); r.headers.push(("content-type".into(),"text/html; charset=utf-8".into())); a form POST answers 303 with ("location","/"); at most one ("set-cookie",...) per reply. Store db, each call async -> io::Result: get(&[u8])->Option<Vec>; put(&[u8],&[u8]); add(&[u8],i64)->(new,version), an atomic counter get reads as decimal text; scan_prefix(prefix,None,500)->(Vec<(key,value,version)>,more); put_if_version(k,v,None).await?.is_ok() creates k only if absent. std and ferrite_app only (ferrite_app::serde_json), escape visitor text in HTML. #[test]s go in src/main.rs under #[cfg(test)]; deploy_source does not run them (see test_ref).
Returns {admitted, violations:[{code,detail}], test_admitted, test_violations, tests_scanned}. packages adds Ferrite source packages under src//.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"files": "<files>"
},
"name": "code_gate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | map of relative path -> file content, e.g. {"Cargo.toml": "...", "src/lib.rs": "..."} | |
| packages | No | Ferrite source packages to compile in, by name from list_packages ("name" or "name@version"). The server adds each package's files, and its dependencies', under src/<root>/ before anything reads `files`; declare each root in src/lib.rs (read_package gives the lines). Do not send those files yourself: a changed copy is refused. |